9
Inheritance and Polymorphism
In Chapter 8, we learned about classes, objects, and enums. Initially, we explored the relationship between classes and objects and the need to separate the reference type from the object type. We contrasted instance versus class members and saw that using the static keyword applies class scope to a member. We discussed the this reference and demonstrated that inside an instance method, the this reference refers to the object instance responsible for the method call. We also covered various access modifiers: private, package-private (no keyword), protected, and public. These modifiers enable us to apply one of the cornerstones of OOP, namely encapsulation. While encapsulation is commonly referred to as “private ...
Get Learn Java with Projects now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.