Chapter 9

Inheriting Code and Data in Java

You’ve come a long way already in this book. In this chapter and the next two, you get the payoff: learning how to inherit code, create so-called pure types, and examine a type system. As I cover each of these topics, you’ll get your first look at moving from writing programs that happen to be Java classes to writing classes that can be used to build multiple programs.

It’s a challenging step to move from writing code you need right now to writing code you can reuse. It is a practice that takes time to master. You’ll start in this chapter by understanding how you can extend code that’s already been written.

In this chapter, I’ll cover the following topics:

  • Extending a class
  • Using the super keyword

Get Java SE 7 Programming Essentials 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.