Hour 12. Making the Most of Existing Objects

This might be a surprise to you, but your Java objects are ideally suited for childbearing. When you create a program as an object—a set of attributes and behavior—you have designed something that's ready to pass on these qualities to offspring. Like most offspring, these child objects will take on a lot of the attributes and behavior of their parent. They also can do some things differently than their parent does; some extra attributes and behavior can be added that dad is incapable of. This system is called inheritance, and it's something every superclass (parent) gives to its subclasses (children). Inheritance is one of the most useful aspects of object-oriented programming, and you'll be learning more about it during this hour. Another useful aspect of object-oriented coding is the capability to create an object that can be used with different programs. Reusability speeds up the software development process and makes it easier to develop error-free, reliable programs. Using Java and special development tools, you can develop JavaBeans—completely reusable Java objects that are easily incorporated into programs. The following topics will be covered:

  • Designing superclasses and subclasses
  • Forming an inheritance hierarchy
  • Overriding methods
  • Developing JavaBeans