1Z0-804 · Question #54
Given the code fragment: Which code fragment inserted at line ***, enables the code to compile?
The correct answer is E. public void process (){. A: Compilation fails: Exception IOException is not compatible with throws clause in B: Compilation fails: Exception IOException is not compatible with throws clause in C: Compilation fails: Exception Exception is not compatible with throws clause in Base.process() D…
Question
Given the code fragment:
Which code fragment inserted at line ***, enables the code to compile?
Exhibit
Options
- Apublic void process () throws FileNotFoundException, IOException {
- Bpublic void process () throws IOException {
- Cpublic void process () throws Exception {
- Dpublic void process (){
- Epublic void process (){
How the community answered
(37 responses)- A5% (2)
- B8% (3)
- C14% (5)
- D3% (1)
- E70% (26)
Explanation
A: Compilation fails: Exception IOException is not compatible with throws clause in B: Compilation fails: Exception IOException is not compatible with throws clause in C: Compilation fails: Exception Exception is not compatible with throws clause in Base.process() D: Compilation fails: Exception FileNotFoundException has already been caught by the alternative IOException Alternatives in a multi-catch statement cannot be related to subclassing Alternative java.io.FileNotFoundException is a subclass of alternative java.io.IOException
Topics
Community Discussion
No community discussion yet for this question.
