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?
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?
The code attempts to read all the lines from the employee.txt file and append them to allemp.txt. Since the StandardOpenOption.APPEND is used, it requires the file allemp.txt to already exist. However, since allemp.txt does not exist, an IOException will be thrown the first time the code tries to append to the file. Therefore, the program will catch the IOException and print "Exception 1".
A and if allemp.txt is exist, the content of employee.txt is copied to it.
A - tested *
A is the answer
The answer is A because the StandardOpenOption.APPEND which requires the file to exist.
C - tested