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? tccicomputercoaching.com

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.in);

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

// String input

String name = input.nextLine();

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

}

}

Output:

Enter the Name: mili

Name is mili

To learn more in detail about Java at TCCI

Call us @ 9825618292

Visit us @ http://www.tccicomputercoaching.com

 

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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