By deriving from other classes, Java’s inheritance mechanism allows classes to be nested one above the other. Java inheritance is transitive, therefore if Sedan extends Car and Car extends Vehicle, then Sedan also derives from the Vehicle class. The vehicle becomes the superclass for both cars and sedans.
Vishalini.R Answered question September 7, 2023
