Organizing Classes and Class Behavior

An introduction to object-oriented programming in Java isn't complete without a first look at three concepts: inheritance, interfaces, and packages.

These three things all are mechanisms for organizing classes and class behavior. The Java class library uses these concepts, and the classes you create for your own programs also need them.

Inheritance

Inheritance is one of the most crucial concepts in object-oriented programming, and it has a direct effect on how you design and write your own Java classes.

Inheritance is a mechanism that enables one class to inherit all the behavior and attributes of another class.

Through inheritance, a class immediately has all the functionality of an existing class. Because ...

Get Sams Teach Yourself Java 2 in 21 Days, Second Edition 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.