Java 101 primer: Composition and inheritance

A quick guide to the composition technique in Java programming

Current Job Listings

In "Java 101: Inheritance in Java, Part 1," you learned how to leverage inheritance for code reuse, by establishing is-a relationships between classes. This free Java 101 primer focuses on composition, a closely related programming technique that is used to establish has-a relationships instead. Whereas inheritance extends the features of one class to another, composition allows us to compose a class from another class. The distinction may seem subtle, but it will make more sense once you see it in code.

To continue reading this article register now

How collaboration apps foster digital transformation
Shop Tech Products at Amazon