Oracle
1Z0-804 · Question #51
Given the code fragment: What is the result, if the file salesreport.dat does not exist?
The correct answer is B. Compilation fails only at line 13. Compilation fails Line 13 : The resource br of a try-with-resources statement cannot be assignedresources are final in try-with-resources statements
Java I/O Fundamentals
Question
Given the code fragment:
What is the result, if the file salesreport.dat does not exist?
Exhibit
Options
- ACompilation fails only at line 6
- BCompilation fails only at line 13
- CCompilation fails at line 6 and 13
- DClass java.io.IOException
- EClass java.io.FileNotFoundException
How the community answered
(18 responses)- B83% (15)
- C11% (2)
- D6% (1)
Explanation
Compilation fails Line 13 : The resource br of a try-with-resources statement cannot be assignedresources are final in try-with-resources statements
Topics
#FileInputStream#IOException#checked exception#compilation
Community Discussion
No community discussion yet for this question.
