1Z0-803 · Question #50
Given the code fragment: interface SampleClosable { public void close () throws java.io.IOException; } Which three implementations are valid?
The correct answer is A. Option A C. Option C E. Option E. A: Throwing the same exception is fine. C: Using a subclass of java.io.IOException (here java.io.FileNotFoundException) is fine E: Not using a throw clause is fine. Incorrect answers: B: Exception is not a subclass of java.io.IOException and cannot be used here. D: Not extends. S
Question
Given the code fragment:
interface SampleClosable { public void close () throws java.io.IOException; } Which three implementations are valid?
Exhibit
Options
- AOption A
- BOption B
- COption C
- DOption D
- EOption E
How the community answered
(29 responses)- A79% (23)
- B7% (2)
- D14% (4)
Explanation
A: Throwing the same exception is fine. C: Using a subclass of java.io.IOException (here java.io.FileNotFoundException) is fine E: Not using a throw clause is fine. Incorrect answers: B: Exception is not a subclass of java.io.IOException and cannot be used here. D: Not extends. SampleCloseable cannot be the superclass of Test, a superclass must be a (An interface extends other interfaces.)
Topics
Community Discussion
No community discussion yet for this question.
