Practice question
3 marksA class B extends class A, and both define a method show(). If A a = new B(); a.show(); is executed, which version runs and why?
Inheritance and PolymorphismMediumNumerical
Computer Science · Class 12 · ISC
Single and multilevel inheritance, method overriding and overloading, abstract classes and interfaces.
6questions
Syllabus mapping: ISC syllabus (CISCE) (opens CISCE's website in a new tab)
6 questions
Practice question
3 marksA class B extends class A, and both define a method show(). If A a = new B(); a.show(); is executed, which version runs and why?
Inheritance and PolymorphismMediumNumerical
Practice question
3 marksWhat does the super keyword do in Java?
Inheritance and PolymorphismMediumShort answer
Practice question
3 marksDistinguish between method overloading and method overriding.
Inheritance and PolymorphismMediumShort answer
Practice question
3 marksWhy does Java not allow a class to extend more than one class?
Inheritance and PolymorphismMediumShort answer
Practice question
3 marksWhat is an abstract class, and how does it differ from an interface in Java?
Inheritance and PolymorphismMediumShort answer
Practice question
3 marksWhat is dynamic method dispatch, and why is it useful?
Inheritance and PolymorphismMediumShort answer