The Scanner class produces very useful objects.

Scanners can help read lines, integers from the prompt, which is shown in this program.

Compile and run this program in the usual style: javac the .java file, then java the .class file.

Here's the documentation for the Scanner class. This is a straight-line program.