How do I read from standard input?

Standard input (stdin) is represented by System.in. System.in is an instance of the class java.io.InputStream. This means that all its methods work on bytes, not Strings.
To read from keyboard, use the Reader classes provided since JDK 1.1 They provide unicode manipulation.
Following is an example that reads in 2 Strings from stdin, converts them to integers and displays the multiplication of the two.

import java.io.*; 
 
public class Multiply { 
 
   public static void main (String[] args) { 
      int firstNum, secondNum, result;
 
      //  open up standard input 
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 
 
      try { 
         System.out.print("Enter first number: "); 
         firstNum = Integer.parseInt(br.readLine());
         System.out.print("Enter second number: "); 
         secondNum = Integer.parseInt(br.readLine());
         result = firstNum * secondNum;
 
         System.out.println("The multiplication is " + result); 
      } catch (IOException e) { 
         System.out.println(e);
      } 
   } 
}