No. (Of course, it can be opened again, and then written to.)
Here is an excerpt from the example program.
The constructor for FileWriter
is passed a String which contains the
name for the file.
When the FileWriter
is constructed,
a new disk file is created in the current
directory and given that name,
replacing any previous file with the same name.
The file will be named "reaper.txt" and the stream that
writes to it is writer.
public static void main ( String[] args ) throws IOException { String fileName = "reaper.txt" ; FileWriter writer = new FileWriter( fileName ); . . . . . }
The two constructors that interest us are:
FileWriter(String fileName) FileWriter(String fileName, boolean append)
If append
is true
,
the second constructor
will open an existing file will for writing
without destroying its contents.
If the file does not exist, it will be created.