Picture of the Objects

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

What are the values of x and y in the third point?

Answer:

x = 12 and y = 45.

Picture of the Objects

Points b and c were constructed with the statements

    b = new Point( 12, 45 ); 
    c = new Point( b );

The constructor for point c is supplied with data in the form of point b. It seems reasonable that the x and y of c will take their values from b. (To be sure, check the documentation. )

After the three objects have been created (just before the program closes) the situation looks like this:

three variables pointing at three objects

Each reference variable refers to an object. Each object contains its own data and its methods. (For clarity, only some methods are shown.) An object does not contain any constructors.

QUESTION 6:

Look at the picture. Is it clear what the phrase "the object a" means?