Reading User Input Using the Scanner Class in Java

Java is very versatile in its ability, but can become even more versatile with the integration of user input. One way to have user input is the Scanner Class. This class allows the programmer to scan the keyboard and get input from the user.

How to Instantiate the Scanner Class

Since it is not built into the regular Java library, it needs to be imported. It can be imported like so:

Scanner Class import

or

Screen Shot 2016-03-01 at 1.04.58 PM

Note: All imports are declared at the top of the program before the main method like so:

Screen Shot 2016-03-01 at 1.05.22 PM

Read more

YouTube
LinkedIn
Share
RSS