Oracle
1Z0-809 · Question #47
1Z0-809 Question #47: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #47. The question stem and answer options stay visible for context.
Question
Given the code fragment:
public static void main (String[] args) throws IOException {
BufferedReader bRcopy = null;
try (BufferedReader bR = new BufferedReader (new
FileReader ("employee.txt"))) { //
line n1
bR.lines().forEach (c -> System.out.println(c));
bRcopy = bR; //line n2
}
bRcopy.ready(); //line n3;
}
Assume that the ready method of the BufferedReader, when called on a closed BufferedReader, throws an exception, and employee.txt is accessible and contains valid text. What is the result?
Options
- AA compilation error occurs at line n3.
- BA compilation error occurs at line n1.
- CA compilation error occurs at line n2.
- DThe code prints the content of the employee.txt file and throws an exception at line n3.
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.