what is inheritance with example
Inheritance is the process wherein characteristics are inherited from ancestors. Similarly, in Java, a subclass inherits the characteristics (properties and methods) of its superclass (ancestor). For example, a vehicle is a superclass and a car is a subclass. The car (subclass) inherits all of the vehicleâs properties.