logo CodeStepByStep logo

pointCoordinates

Language/Type: Java classes Point reference semantics

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);
p1
p2
p3

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.