ProgLesson4 Java User Input
ProgLesson4 Java User Input
To get the instance of Java Scanner which reads input from the user, we
need to pass the input stream (System.in) in the constructor of Scanner
class.
To use the Scanner class, create an object of the class and use any of
the available methods found in the Scanner class documentation. In our
example, we will use the nextLine() method, which is used to read
Strings:
Output:
Input Types
In the previous example, we used nextLine() method which is used to read Strings. To read other types, look at the table below.
Output:
Output:
Activity
Design a program that will display your 20 personal information using Java
Input. Show your code and output.
THANK YOU
Java User Input