Inheritance in Java is the method to create a hierarchy between classes by inheriting from other classes. Java Inheritance is transitive – so if Sedan extends Car and Car extends Vehicle, then Sedan is also inherited from the Vehicle class. The Vehicle becomes the superclass of both Car and Sedan.
Sandhya Answered question September 7, 2023