O'Reilly logo

Learn Java for Android Development, Second Edition by Jeff Friesen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    4

Discovering Inheritance, Polymorphism, and Interfaces

An object-based language is a language that encapsulates state and behaviors in objects. Java’s support for encapsulation (discussed in Chapter 3) qualifies it as an object-based language. However, Java is also an object-oriented language because it supports inheritance and polymorphism (as well as encapsulation). (Object-oriented languages are a subset of object-based languages.) In Chapter 4 I introduce you to Java’s language features that support inheritance and polymorphism. Also, I introduce you to interfaces, Java’s ultimate abstract type mechanism.

Building Class Hierarchies

We tend to categorize stuff by saying things like “cars are vehicles” or “savings accounts are ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required