filmov
tv
Java Read from a File, Write to a File

Показать описание
Rio Hondo College
CIT 136 Java Programming
To read input from a disk file, the Scanner class relies on another class, File, which describe disk files and directories.
Then use the File object to construct a Scanner object:
Scanner in = new Scanner (inputFile);
To write output to a file, you construct a PrintWriter object with the desired file name.
When you are done processing a file, be sure to close the Scanner or PrintWriter:
Professor Liu
CIT 136 Java Programming
To read input from a disk file, the Scanner class relies on another class, File, which describe disk files and directories.
Then use the File object to construct a Scanner object:
Scanner in = new Scanner (inputFile);
To write output to a file, you construct a PrintWriter object with the desired file name.
When you are done processing a file, be sure to close the Scanner or PrintWriter:
Professor Liu