READ Free Dumps For Oracle- 1z0-804
Question ID 21465 | Given the code fragment:
public static void displayDetails() {
try ( BufferedReader br = new BufferedReader(new FileReader("salesreport.dat")) ) { // Line6
String record;
while ( (record = br.readLine()) != null) {
System.out.println(record);
}
br.close();
br = new BufferedReader(new FileReader("annualreport.dat")) ; // Line13
while ( (record = br.readLine()) != null) {
System.out.println(record);
}
} catch (IOException e) {
System.err.println(e.getClass());
}
}
What is the result, if the file salesreport.dat does not exist?
|
Option A | Compilation fails only at line 6
|
Option B | Compilation fails only at line 13
|
Option C | Compilation fails at line 6 and 13
|
Option D | Class java.io.IOException
|
Option E | Class java.io.FileNotFoundException
|
Correct Answer | B |
Explanation Explanation: Compilation fails Line 13 : The resource br of a try-with-resources statement cannot be assigned resources are final in try-with-resources statements
Question ID 22447 | 1
|
Option A | 1
|
Option B | 1
|
Option C | 1
|
Option D | 1
|
Option E | 1
|
Option F | 1
|
Correct Answer | 1 |
Explanation