explain what is multilevel inheritance the


Explain what is Multilevel Inheritance ?

The Car-Motorcycle-MotorVehicle instances showed single-level inheritance. There's nothing to stop you from going next. You can describe subclasses of cars for compacts, station wagons, sports coupes and more. For instance, this class describes a compact as a car with two doors:

public class Compact extends Car {

// constructors
public Compact(String licensePlate, double maxSpeed,
String make, String model, int year, int numberOfPassengers) {
this(licensePlate, 0.0, maxSpeed, make, model, year, numberOfPassengers);
}

public Compact(String licensePlate, double speed, double maxSpeed,
String make, String model, int year, int numberOfPassengers) {
super(licensePlate, speed, maxSpeed, make, model,
year, numberOfPassengers, 2);
}
}
Compact not only inherits from its immediate superclass, Car, but also from Car's superclass, MotorVehicle. Therefore the Compact class also has a make, a model, a year and so on. There's no limit to this chain of inheritance, by getting more than four or five classes deep creates code excessively complex. 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: explain what is multilevel inheritance the
Reference No:- TGS0284628

Expected delivery within 24 Hours