go to previous page   go to home page   go to next page

Answer:

Class A is the parent, because class B is based upon it.


Single Inheritance

child isa parent

The class that is used to define a new class is called a parent class (or superclass or base class.) The class based on the parent class is called a child class (or subclass or derived class.)

In Java, (unlike with humans) children inherit characteristics from just one parent. This is called single inheritance. Some languages allow a child to inherit from more than one parent. This is called multiple inheritance. With multiple inheritance, it is sometimes hard to tell which parent contributed what characteristics to the child (as with humans). Java avoids these problems by using single inheritance.


QUESTION 3:

(Thought question: ) Can a parent class have more than one child class? (Hint: think about humans.)