nerdexam
Oracle

1Z0-819 · Question #19

Given: ``java public interface A { a(); } public interface B extends A { b(); } public interface C extends A { public Path c(); } public interface D extends B, C { } `` Why does D cause a…

The correct answer is B. D inherits a() from B and C but the return types are incompatible. See the full explanation below for the reasoning.

Question

Given:
public interface A {
 a();
}
public interface B extends A {
 b();
}
public interface C extends A {
 public Path c();
}
public interface D extends B, C {
}
Why does D cause a compilation error?

Options

  • AD inherits a() only from C.
  • BD inherits a() from B and C but the return types are incompatible.
  • CD inherits c() only from interface.
  • DD does not define any method.

How the community answered

(46 responses)
  • A
    7% (3)
  • B
    76% (35)
  • C
    13% (6)
  • D
    4% (2)

Community Discussion

No community discussion yet for this question.

Full 1Z0-819 Practice