scanner in java scanner class in java scanner in java example using scanner in java scanner example in java
use of scanner in java scanner method in java scanner class in java scanner class in java with example
scanner in java example read in file scanner in java api scanner class in java api
Scanner Or java.util.Scanner :
Scanner is one of the predefined class present in java .util.* package. The basic aim of
Scanner class is to read the data from keyboard dynamically.
Profile Of Scanner :
1) Scanner(InputStream) :
This Scanner constructor in which Inputstream is one of the predefined class whose object called in created as static data member in System class.
System.in is always gives control to keyboard.
Ex : Scanner s=new Scanner(System.in);
Instance Methods :
2) Public Xxx nextXxx() :
This method is used for reading fundamental values from keyboard. And Xxx represents any fundamental data type.
For Example :
Public int nextInt()
Public float nextFloat()………etc……
3) Public String nextLine() :
This method is used for reading any type of value from keyboard in the form of String type
The Following Program the concept of Scanner Class :
Public static void main(String args)
Scanner s=new Scanner(System.in);
System.out.println(“Enter the first number”);
System.out.println(“Enter the Second number”);
System.out.println(“Total result is” +result);
Data Extraction Interfaces are as follows :
1- D and 2-D Collection Frame work classes are