Java Input, Output and token operation

 Input ( Scanner class ) 

Scanner is a pre-defined class in java which is available in java.util package. it is used to get input in runtime.

Scanner sc = new Scanner(System.in)
int a = sc.nextInt();
Scanner class methods:
nextLine();  // String 
nextInt();   //  integer
nextFloat();  //  float type
nextBoolean();  //  true or false
nextDouble();  // double type
Token 
Token is the smallest element of a program that is identified by a complier. Every java statement and expression are created using tokens
  1. keywords
  2. identifiers
  3. operator
  4. separator
  5. literal
class HelloWorld {
    public static void main(String[] args) {
        int a =10;
        int b = 20;
        int c = a + b;
        System.out.println(c);
    }
}
In this program:
i. keyword : int, static, void
ii. identifire : variable name, method name, class name, package name
iii. Operator : (+  -  *  /  %  &&  || )
iv. Sepreator : ( ; , .  :  ( ) { } )