Main Page

Previous Next

Chapter 6: Extending Classes and Inheritance


A very important part of object-oriented programming allows you to create a new class based on a class that has already been defined. The class that you use as the base for your new class can be either one you have defined, a standard class in Java, or a class defined by someone else – perhaps from a package supporting a specialized application area.

This chapter focuses on how you can reuse existing classes by creating new classes based on the ones you have, and explores the ramifications of using this facility, and the additional capabilities it provides. We will also delve into an important related topic – interfaces – and how you can use them.

In this chapter you will learn:

  • How to reuse classes by defining a new class based on an existing class.

  • What polymorphism is and how to define your classes to take advantage of it.

  • What an abstract method is.

  • What an abstract class is.

  • What an interface is and how you can define your own interfaces.

  • How to use interfaces in your classes.

  • How interfaces can help you implement polymorphic classes.

Previous Next
JavaScript Editor Java Tutorials Free JavaScript Editor