go to previous page   go to home page   go to next page hear noise highlighting

Answer:

Is Nissan a child of Automobile? Yes.
Is Nissan the parent of Sentra? Yes.


Extends

A class may be the parent for a another child class and may be a child of a parent class. Just as with humans, a person is a child of some humans and a parent to others. (But in Java a child has only one parent.)

The syntax for deriving a child class from a parent class is:

class childClass extends parentClass
{
   // new members and constructors of the child class go here
    
}

Members (variables and methods) of the parent class are included in the child by inheritance. Additional members are added to the child in its class definition.


QUESTION 8:

(Thought question:) Can your class extend more than one parent class?


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