ScannerExample
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
This program shows how to use the Scanner class to accept input from the user. Pay attention to when the Scanner object advances to the next line. You control this behavior. Here is a sample run: C:\Temp>java ScannerExample Enter your name: Joe Enter your age: 23 Enter three numbers: 4 5 9 Enter your favorite food: pizza Enter your favorite number and color: 44 black Hello Joe! You are 23 years old. The average of those three numbers is 6.0 Your favorite food is pizza. Your favorite number and color are 44 and black. C:\Temp>