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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.