← All topics
Quiz: Inheritance and Polymorphism: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What does this print? (code)
- Q2. Where must super(...) appear in a constructor?
- Q3. Overriding is an example of:
- Q4. Which class can't be extended?
- Q5. How many classes can a Java class directly extend?
- Q6. What does this print? (code)
- Q7. What does this print? (code)
- Q8. What does this print? (code)
- Q9. Animal a = new Animal(); Dog d = (Dog) a; What happens?
- Q10. You write @Override on a method but misspell its name. What happens?