Podcast
Questions and Answers
What are the advantages of Inheritance?
What are the advantages of Inheritance?
- Method overloading and method overriding
- Method hiding and method overriding
- Code reusability and method overriding (correct)
- Code reusability and method hiding
What is the Super keyword used for in Java?
What is the Super keyword used for in Java?
- To access the parent class’s variables, methods, and constructors (correct)
- To override methods in the subclass
- To define a new class from an existing class
- To implement single inheritance
What is the difference between single inheritance and hierarchical inheritance?
What is the difference between single inheritance and hierarchical inheritance?
- Single inheritance allows a subclass to have only one superclass, while hierarchical inheritance allows a superclass to have multiple subclasses (correct)
- Single inheritance allows a subclass to have multiple superclasses, while hierarchical inheritance allows a superclass to have only one subclass
- Single inheritance allows a superclass to have multiple subclasses, while hierarchical inheritance allows a subclass to have only one superclass
- Single inheritance allows a subclass to have multiple superclasses, while hierarchical inheritance allows a superclass to have multiple subclasses