Table of Contents
Java language input Scanner tutorial
In this tutorial, we will discuss the concept of Java language input Scanner tutorial
Java input Scanner class
The java.util.Scanner class is used to read input of primitive type of data, like int, double, float etc .. from the user in java.
How to get input from user in Java
Follow the steps given below:-
- import java.util.Scanner class
- Create the object of scanner class
- use in-built methods to get input
In-built methods and description for getting input in Scanner class of Java
We will learn to use the simple example of the java Scanner class. We can read the int, string and double as an input using scanner class
Program 1
When we executed the above program, it produced the following results
Enter the number….
100
You entered 100
Program 2
When we executed the above program, it produced the following results
program 3
When we executed the above program, it produced the following results
Scanner Delimiters with Scanner class
Program 1
We will learn the example of Scanner class with delimiter
When we executed the above program, it produced the following results
Suggested for you