The computer picks a number between 1 and 100 and the user has to guess it in as fewer tries as possible. This sort of program is commonly used in the teaching of programming languages as it demonstrates loops, if statements, variable assignments and user input/output.
The program uses SavitchIn for input, apparently it's under the GPL so I can redistribute it, if this isn't the case, please let me know so I can remove it before sueing me :P
I've written a full explanation of the code, line by line which you can find on this page.
The full source code is included in the zip file, along with the SavitchIn class. To compile the program just run the command 'javac guessit.java' followed by 'java guessit'. The SavitchIn class is already compiled for you.
Source: java_guessit.zip