Inheritance in Java
Inheritance in Java - Important Points
16. | Which of the following is an example of multilevel inheritance? |
---|
A. Class A extends Class B, Class C extends Class A
B. Class A extends Class B, Class B extends Class C
C. Class A extends Class B, Class A extends Class C
D. Class A extends Class B, Class B extends Class A
View Answer Discuss Work SpaceAnswer: option a
Explanation:
17. | Which keyword is used to implement method overriding in Java? |
---|
A. final
B. static
C. abstract
D. override
View Answer Discuss Work SpaceAnswer: option d
Explanation:
18. | Which type of inheritance is used in Java for interfaces? |
---|
A. Single inheritance
B. Multiple inheritance
C. Hybrid inheritance
D. Hierarchical inheritance
View Answer Discuss Work SpaceAnswer: option b
Explanation:
19. | Which method of the Object class is used to return a string representation of an object? |
---|
A. hashCode()
B. equals()
C. toString()
D. getClass()
View Answer Discuss Work SpaceAnswer: option c
Explanation:
20. | Which keyword is used to create a subclass in Java? |
---|
A. abstract
B. final
C. static
D. extends
View Answer Discuss Work SpaceAnswer: option d
Explanation: