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:
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:
9450127744
ReplyDelete8604176402 utkarsh
ReplyDelete