February 2017
Beginner
1056 pages
28h 57m
English
An ounce of prevention is worth a pound of cure.
—COMMON SAYING
This section discusses some techniques that we can use with both text files and binary files, even though our examples here will involve text files. We begin by describing the standard class File, which we used in the previous section when reading from a text file.
FileThe class File provides a way to represent file names in a general way. A string such as "treasure.txt" might be a file name, but it has only string properties, and Java does not recognize it as a file name. On the other hand, if you pass a file name as a string to the constructor of the class File, it produces an object that can be thought of as the name of a file. In other ...
Read now
Unlock full access