Inheritance in Java
Inheritance in Java - Important Points
6. | Which method of the Object class is called when an object is no longer referenced? |
---|
A. finalize()
B. delete()
C. destroy()
D. dispose()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The 'finalize()' method of the Object class is called when an object is no longer referenced.
7. | What is the name of the process of creating a new class by extending an existing class? |
---|
A. Abstraction
B. Polymorphism
C. Inheritance
D. Encapsulation
View Answer Discuss Work SpaceAnswer: option c
Explanation:
Inheritance is the process of creating a new class by extending an existing class.
8. | Which keyword is used to invoke the constructor of the parent class? |
---|
A. this
B. super
C. extends
D. implements
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The 'super' keyword is used to invoke the constructor of the parent class.
9. | Which of the following is NOT a type of inheritance in Java? |
---|
A. Single inheritance
B. Multiple inheritance
C. Hybrid inheritance
D. Hierarchical inheritance
View Answer Discuss Work SpaceAnswer: option c
Explanation:
Hybrid inheritance is not a type of inheritance in Java.
10. | Which method of the Object class is used to return a hash code value for an object? |
---|
A. hashCode()
B. equals()
C. toString()
D. getClass()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The 'hashCode()' method of the Object class is used to return a hash code value for an object.