Inheritance in Java
Inheritance in Java - Important Points
11. | Which keyword is used to create an abstract class in Java? |
---|
A. abstract
B. final
C. static
D. synchronized
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The 'abstract' keyword is used to create an abstract class in Java.
12. | Which type of inheritance is a combination of single and multiple inheritance? |
---|
A. Hybrid inheritance
B. Multiple inheritance
C. Hierarchical inheritance
D. Multilevel inheritance
View Answer Discuss Work SpaceAnswer: option a
Explanation:
Hybrid inheritance is a combination of single and multiple inheritance.
13. | Which of the following is NOT a benefit of inheritance? |
---|
A. Reusability of code
B. Increased complexity of code
C. Polymorphism
D. Reduced development time
View Answer Discuss Work SpaceAnswer: option b
Explanation:
Increased complexity of code is not a benefit of inheritance.
14. | Which method of the Object class is used to compare two objects for equality |
---|
A. hashCode()
B. equals()
C. toString()
D. getClass()
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The 'equals()' method of the Object class is used to compare two objects for equality.
15. | Which keyword is used to create an interface in Java? |
---|
A. abstract
B. interface
C. implements
D. extends
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The 'interface' keyword is used to create an interface in Java.