1Z0-804 · Question #49
Given the code fragment: What is the result, if the file myfile.txt does not exist?
The correct answer is D. Compilation fails. !! Compilation fails if FileNotFoundException is tried to catch (Line 12) (The exception FileNotFoundException is already caught by the alternative IOException) -------------------------------- --------------------------------------------------------------- if this is removed…
Question
Given the code fragment:
What is the result, if the file myfile.txt does not exist?
Exhibit
Options
- AA runtime exception is thrown at line 4
- BA runtime exception is thrown at line 7
- CCreates a new file and prints no output
- DCompilation fails
How the community answered
(34 responses)- A9% (3)
- B3% (1)
- C12% (4)
- D76% (26)
Explanation
!! Compilation fails if FileNotFoundException is tried to catch (Line 12) (The exception FileNotFoundException is already caught by the alternative IOException) -------------------------------- --------------------------------------------------------------- if this is removed will be thrown a FileNotFoundException at line 4.
Topics
Community Discussion
No community discussion yet for this question.
