posted 23 years ago
Hi all,
Which of the following statements are true, given the code new FileOutputStream("output.txt", true) for creating an object of class FileOutputStream?
a. No matching constructor.
b. It may throw a SecurityException but will never throw FileNotFoundException bcoz of the 2nd parameter which is true.
c. If a file named "output.txt" exists, its contents will be reset & overridden
d. If a file named "output.txt" exists, output will be appended to its current contents.
When I looked into the API, It says,
" If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a FileNotFoundException is thrown."
But never could I find that the file will be over written or appended.
Your help is appreciated.
Thx
Aruna