Inheritance in Java is a powerful Object-Oriented Programming (OOP) feature that allows one class to acquire properties and behaviours of another. It promotes code reusability, method overriding, and enables hierarchical relationships between classes.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which of the following supports multiple inheritance in Java?
Correct
Incorrect
Question 4 of 15
4. Question
What is the output of this code?
class A { int a = 10; } class B extends A { int b = 20; }
What does new B().a return?
Correct
Incorrect
Question 5 of 15
5. Question
What is the base class of all Java classes?
Correct
Incorrect
Question 6 of 15
6. Question
Which type of inheritance is not directly supported in Java classes?
Correct
Incorrect
Question 7 of 15
7. Question
What is the purpose of the super keyword in Java?
Correct
Incorrect
Question 8 of 15
8. Question
Which of these is true about constructor inheritance in Java?
Correct
Incorrect
Question 9 of 15
9. Question
Can a subclass access private members of its superclass?
Correct
Incorrect
Question 10 of 15
10. Question
What type of inheritance is this?
class A {} class B extends A {} class C extends B {}
Correct
Incorrect
Question 11 of 15
11. Question
Can a class inherit from more than one class in Java?
Correct
Incorrect
Question 12 of 15
12. Question
What is method overriding?
Correct
Incorrect
Question 13 of 15
13. Question
Which access modifier allows inheritance to a subclass in another package?
Correct
Incorrect
Question 14 of 15
14. Question
Which of the following allows reusability in Java?
Correct
Incorrect
Question 15 of 15
15. Question
What is hierarchical inheritance?
Correct
Incorrect
Summary
Inheritance in Java is a foundational OOP concept that allows classes to acquire behaviour and properties from other classes, leading to cleaner, modular, and reusable code. Java supports single, multilevel, and hierarchical inheritance using the `extends` and `implements` keywords.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.