🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Abstract Classes and Interfaces: all 10 questions

Quiz: Abstract Classes and Interfaces · Question 7 of 10

A class implements an interface but does not implement one of its abstract methods. What happens?

A class implements an interface but does not implement one of its abstract methods. What happens?

  1. A.The method returns null by default
  2. B.It compiles, and calling the method throws an exception
  3. C.Compile error, unless the class itself is declared abstract
  4. D.Java writes an empty method automatically
Answer & explanation

Correct answer: Compile error, unless the class itself is declared abstract

A concrete class must implement every abstract method it inherits; only an abstract class may leave some out.

Can you get the rest right without peeking?

Take the timed Quiz: Abstract Classes and Interfaces quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →