logo Practice-It logo


Language/Type: Java Objects Point reference semantics
Author: Roy McElmurry (on 2010/12/28)

What are the x- and y-coordinates of the Points referred to as p1, p2, and p3 after the following code executes? Give your answer as an x-y pair such as (0, 0).

Point p1 = new Point(17, 9);
Point p2 = new Point(4, -1);
Point p3 = p2;

p1.translate(3, 1);
p2.x = 50;
p3.translate(-4, 5);

You must log in before you can solve this problem.

Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.