Which of the following is true about inheritance in Java.
1) In Java all classes inherit from the Object class directly or indirectly. The Object class is root of all classes.
2) Multiple inheritance is not allowed in Java.
3) Unlike C++, there is nothing like type of inheritance in Java where we can specify whether the inheritance is protected, public or private.
(A) 1, 2 and 3
(B) 1 and 2
(C) 2 and 3
(D) 1 and 3
Answer: (A)
Explanation: See Comparison of Inheritance in C++ and Java
Quiz of this Question
Recommended Posts:
- Java | Inheritance | Question 1
- Java | Inheritance | Question 2
- Java | Inheritance | Question 3
- Java | Inheritance | Question 4
- Java | Inheritance | Question 5
- Java | Inheritance | Question 9
- Java | Inheritance | Question 8
- Java | Inheritance | Question 9
- Inheritance and constructors in Java
- Comparison of Inheritance in C++ and Java
- Java and Multiple Inheritance
- Inheritance in Java
- Using final with Inheritance in Java
- Interfaces and Inheritance in Java
- Object Serialization with Inheritance in Java
- Delegation vs Inheritance in Java
- Difference between Inheritance and Composition in Java
- Difference between Inheritance and Interface in Java
- Inheritance of Interface in Java with Examples
- C++ | Inheritance | Question 1

