Wednesday, August 29, 2012

what's scanner class?


The Scanner class is a class in java.util, which allows the user to read values of various types

Class Constructors

There are two constructors that are particularly useful: one takes an InputStream object as a parameter and the other takes a FileReader object as a parameter.

Scanner in = new Scanner(System.in);  // System.in is an InputStream
Scanner inFile = new Scanner(new FileReader("myFile"))

http://www.cs.utexas.edu/users/ndale/Scanner.html