What is the result, if the file myfile.txt does not exist?
A.
A runtime exception is thrown at line 4
B.
A runtime exception is thrown at line 7
C.
Creates a new file and prints no output
D.
Compilation fails
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.
A
A is correct if we solve compile error on catch.
Answer is D.