Given the content of the employee.txt file:
Every worker is a master.
Given that the employee.txt file is accessible and the file allemp.txt does NOT exist, and the code fragment:
What is the result?
A. Exception 1
B. Exception 2
C. The program executes, does NOT affect the system, and produces NO output.
D. allemp.txt is created and the content of employee.txt is copied to it.
Exception 1
because it can’t find the file allemp.txt
if it was StandardOpenOption.CREATE instead of StandardOpenOption.APPEND
then it would create the allemp.txt file and copy data from employee.txt
so correct answer is A
D, tested
The correct answer is A.
This program will work as specified in D only if the file “attempt.txt” exists.
How did you test it? Please, stop posting wrong answers.
A is the answer, NoSuchFileException occurs.
D, for sure.
Why are you posting wrong answers?
Answer is A