Scanner class - ICSE Java Expert

Breaking

ICSE Java Expert

Learn Java for school

Unordered List

WELCOME

Tuesday, August 07, 2018

Scanner class

In Java programming Scanner class is used to take input from the user.
Scanner is a library class.
Scanner class is defined inside the java.util package.
Their are different functions of Scanner class for taking input of different data types.

Syntax:
import <package name>;
<Scanner>  <object name> = new <Scanner(System.in);>


Example:
import java.util.*;
Scanner sc = new Scanner(System.in);


Question:
Write a java program to input the name of the user and display total number of characters present in that name.

Program:




Video:


2 comments: