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

Answer:


Review of the Object class

Swaping references is common in programming. You will see it a lot in the future. Notice that no new objects were created. Different reference variables were used for already-existing objects.

In Java, the class Object is the ultimate ancestor of all other classes. It is the root of the class hierarchy.

When you define a class like this:

class MyNewClass
{

}

you are actually defining a child of the Object class.

The following is the exact equivalent of the above:

class MyNewClass extends Object
{

}

Every class in Java — your own and every class in every library — descends from Object. This will be important to remember when you get to graphical user interfaces.


QUESTION 15:


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