Chapter 6. Relationships Among Classes


So far in our exploration of Java, we have seen how to create Java classes and objects, which are instances of those classes. By themselves objects would be little more than a convention for organizing code. It is in the relationships between objectstheir connections and privileges with respect to one anotherthat the power of an object-oriented language is really expressed.

That's what we'll cover in this chapter. In particular, we'll look at several kinds of relationships:


Inheritance relationships

How a class inherits methods and variables from its parent class


Interfaces

How to declare that a class implements certain behavior and define a type to refer to that behavior


Packaging

How to organize objects into logical groups


Inner classes

A generalization of classes that lets you nest a class definition inside another class definition



    Learning Java
    Learning Java
    ISBN: 0596008732
    EAN: 2147483647
    Year: 2005
    Pages: 262

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net