Getting user input is one of the most crucial skills to learn in programming.
User input allows the user to interact with the program.
This is useful for programs who retrieve data, such as entering passwords, usernames, surveys, etc.
The example above shows the full program for entering name and age and then printing those two values.
The first step is to import the library by writing " import java.util.Scanner; " after that I simply made two variables(look at previous post for variable definition).
I then made an object called input which is using the Scanner class that we imported.
I then proceed to write print statements to interact with user and get information needed for my program.
After that there are two print statements.
The image above shows us the result of our program.
The program asks for your name and age and then prints both.
Yay our program was a success!!!!