Basic computer course, C programming language, Education, Engineering Course, Engineering Courses, Maths Coaching, online computer coaching, PGDCA course coaching, programming course, school computer coaching, training, Uncategorized, Web Design course

What is scanner class in Java?

Scanner is a class in java.util package used for obtaining the input of the primitive types like int, double etc. and strings. Using Scanner class we can enter the data at run time.

The Java Scanner class breaks the input into tokens using a delimiter that is whitespace by default. It provides many methods to read and parse various primitive values. Java Scanner class is widely used to parse text for string and primitive types using a regular expression.

scanner class in java

import java.util.Scanner;

public class inputdata


public static void main(String[] args)



Scanner input = new Scanner(;

System.out.println(“Enter the Name: “);

// String input

String name = input.nextLine();

System.out.println(“Name: is “+name);




Enter the Name: mili

Name is mili

To learn more in detail about Java at TCCI

Call us @ 9825618292

Visit us @


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s