← Quiz: Inheritance and Polymorphism: all 10 questions
Quiz: Inheritance and Polymorphism · Question 10 of 10
You write @Override on a method but misspell its name. What happens?
You write @Override on a method but misspell its name. What happens?
- A.It silently becomes a new method
- B.It runs the parent's method instead
- C.Compile error: the method does not override anything
- D.A warning appears only at run time
Answer & explanation
Correct answer: Compile error: the method does not override anything
@Override asks the compiler to confirm that a parent method with the same signature exists, which catches typos and wrong parameters.
Can you get the rest right without peeking?
Take the timed Quiz: Inheritance and Polymorphism quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →