Chapter 3

Learning Object-Oriented Language Features

An object-based language encapsulates attributes and behaviors in objects. To be known as an object-oriented language, the language must also support inheritance and polymorphism. This chapter introduces you to Java's language features that support these twin pillars of object orientation. Furthermore, the chapter introduces you to interfaces, Java's ultimate abstract type mechanism.

Inheritance

Inheritance is a hierarchical relationship between entity categories in which one category inherits attributes and behaviors from at least one other category. For example, tiger inherits from animal (tiger is a kind of animal), car inherits from vehicle (car is a kind of vehicle), and checking account ...

Get Learn Java for Android Development 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.