← 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?
- A.The method returns null by default
- B.It compiles, and calling the method throws an exception
- C.Compile error, unless the class itself is declared abstract
- 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 →