Here is another little Java applet: guess a three-digit number. The computer picks the number and keeps asking until I get it right, then tells me how many guesses it took.
This version uses Swing input and message dialogs, even though it is launched from an applet page. The program generates the number with Java’s random-number tools, reads each guess as text, and keeps the number of attempts as part of the game state. At the end it asks whether to play again.
It is not much to look at compared with a graphical game, but these little programs are useful practice. There is still a full cycle to get right: start a game, accept input, decide what it means, show a result, and reset everything for the next round.