nerdexam
Oracle

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

Working with Inheritance

Question

Given the code fragment:

interface SampleClosable { public void close () throws java.io.IOException; } Which three implementations are valid?

Exhibit

1Z0-803 question #50 exhibit

Options

  • AOption A
  • BOption B
  • COption C
  • DOption D
  • EOption E

How the community answered

(29 responses)
  • A
    79% (23)
  • B
    7% (2)
  • D
    14% (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

#interfaces#method overriding#exception handling#IOException

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice