What are the values of x
and y
in the third point?
x = 12 and y = 45.
Point
s 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:
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.
Look at the picture. Is it clear what the phrase "the object a
" means?