Oracle
1Z0-804 · Question #52
Given the code fragment: If the file userguide.txt does not exist, what is the result?
The correct answer is E. Compilation fails. Compilation fails : Exception Exception is not compatible with throws clause in Base.process() IOExceptiondie Exception in der Derived Class Methode muss zur Base Class Methode passen.
Java I/O Fundamentals
Question
Given the code fragment:
If the file userguide.txt does not exist, what is the result?
Exhibit
Options
- AAn empty file iscreated and success is printed
- Bclass java.io.FileNotFoundException
- Cclass java.io.IOException
- Dclass java.lang.Exception
- ECompilation fails
How the community answered
(60 responses)- A3% (2)
- B2% (1)
- C10% (6)
- D5% (3)
- E80% (48)
Explanation
Compilation fails : Exception Exception is not compatible with throws clause in Base.process() IOExceptiondie Exception in der Derived Class Methode muss zur Base Class Methode passen.
Topics
#BufferedReader#FileReader#checked exception#compilation
Community Discussion
No community discussion yet for this question.
