menu

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

Discuss Work Space

Answer: option a

Explanation:

Class A extends Class B, Class C extends Class A is an example of multilevel inheritance.

17. Which keyword is used to implement method overriding in Java?

A. final

B. static

C. abstract

D. override

Discuss Work Space

Answer: option d

Explanation:

The 'override' keyword is used to implement method overriding in Java.

18. Which type of inheritance is used in Java for interfaces?

A. Single inheritance

B. Multiple inheritance

C. Hybrid inheritance

D. Hierarchical inheritance

Discuss Work Space

Answer: option b

Explanation:

Multiple inheritance is used in Java for interfaces.

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()

Discuss Work Space

Answer: option c

Explanation:

The 'toString()' method of the Object class is used to return a string representation of an object.

20. Which keyword is used to create a subclass in Java?

A. abstract

B. final

C. static

D. extends

Discuss Work Space

Answer: option d

Explanation:

The 'extends' keyword is used to create a subclass in Java.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now