April 2019
Intermediate to advanced
360 pages
9h 17m
English
Throughout this chapter, we made use of a Bicycle class. As illustrated in the following, we created a hierarchy to demonstrate inheritance as a key feature of OOP. All objects inherit from the Object class in Java. Our hierarchy has Bicycle inheriting from TwoWheeled, which inherits from Vehicle, which inherits from Object:

For our Bicycle class to work with the intended hierarchy, we created classes for Vehicle and TwoWheeled. Here are those classes:
public class Vehicle {}public class TwoWheeled extends Vehicle {}
The Vehicle and TwoWheeled classes do not offer anything to the Bicycle ...
Read now
Unlock full access