Scanner class in java

0
Share

What is Scanner Class in java ?

Scanner class is a pre-defined class in java & it is available in Java.util package and it is basically used to take different type of input from the keyboard.

What are the different Methods Of scanner Class ?

  • nextInt() – It is used to take the integer type of input from the keyboard.
  • nextbyte() – It is used to take the byte type of input from the keyboard.
  • nextLong() – It is used to take the Long type of input from the keyboard.
  • nextFloat() – It is used to take the float type of input from the keyboard.
  • nextDouble() – It is used to take the double type of input from the keyboard.
  • nextLine() – It is used to take the string type of input from the keyboard.

Syntax Of Scanner Class

Scanner Object name = new Scanner (System.in);
Example- Scanner sc=new scanner (System.in);
Where sc=Object name.

Real more post

  • What are the List of CSS3 New Features ?
    CSS3 is the latest version of the normal CSS . CSS3 adds several new styling features and improvements to enhance the web presentation capabilities. Text Effect in...
  • CSS Basic Property
    What is CSS ? CSS stands for Cascading Style Sheets. CSS basically used in designing the web tags & pages. CSS is the most popular used...
  • Java Program to swap two number use 3rd variable
    In this program, you’ll learn to Program to swap 2 number with 3rd variable in Java. After write the code, the final output is displayed on...
  • Java program to multiply two floating point number
    In this program, you’ll learn to Program to multiply two floating point number in Java. After write the code, the final output is displayed on the...
  • Java Program to find the ASCII value of a character
    In this program, you’ll learn to Program to find the ASCII value of a character in Java. After write the code, the final output is displayed...
  • Java Program to calculate quotient & reminder
    In this program, you’ll learn to Given Number is even or odd in Java. After write the code, the final output is displayed on the screen....
%d bloggers like this: