Scanner Class
 

Use built in Scanner class for keyboard input.

To use you must import java.util.Scanner at top of source code.  Here is an example:

import java.util.Scanner;

public class Assignment {

   public static void main(String[] args) {     

          Scanner s = new Scanner(System.in);
 
          System.out.println("Enter an Integer: ");
          int i = s.nextInt();

         //nextDouble returns double
         //nextLine returns String

    }

}