Each of these classes contains a constructor that accepts a File object.
The File class belongs to the java.io library (io stands for Input Output).
The example below declares a File object that references the io library directly. Notice that a String containing a filepath/filename is passed to the file's constructor. This File object called file, is then passed to the constructor of the Scanner object. In essence we are saying, read from this file at this location.
The next example declares a File object using a shorter declaration. The library reference has been done via an imports statement at the top of the code (not shown). Once again a String filepath/filename has been passed to the constructor. The file object is then passed to the constructor of the PrintWriter object. In short, we are saying, write (print) to this file at this location.
"File (Java)" ( http://bit.ly/JWg0sp )
"java.io (Java Platform SE 6)" ( http://bit.ly/JWhUcw )

















