Java OCA OCP Practice Question 3168

Question

Consider following example:

public interface Printable {
     void abc() throws IOException;
}
public interface Writable {
     void abc() throws FileNotFoundException;
}
public class Implementation implements Printable, Writable {
     // insert code
     { /*implementation*/ }
}

Which of the following statement(s) can you insert in place of "// insert code" comment?

  • A. public void abc() throws IOException
  • B. public void abc() throws FileNotFoundException
  • C. public void abc() throws FileNotFoundException, IOException
  • D. public void abc() throws IOException, FileNotFoundException


B

Note

Since FileNotFoundException is a subtype of IOException, it satisfies both methods.




PreviousNext

Related