Scanner Object to read console input
by rajesh[ Edit ] 2009-12-30 16:41:04
java.util.Scanner can be used to read a from the console..
Example Code
import java.util.Scanner;
public class Scanning {
   public static void main(String[] args) {
       Scanner in = new Scanner(System.in);
       // read a single line from the consoleÂ
       String name = in.nextLine();
       // read next int from the console
       int age = in.nextInt();
       in.close();           Â
    }
}