Question: The default constructor sets x and y to (0, 0) by calling the second constructor. What could be used to replace /* missing code */

The default constructor sets x and y to (0, 0) by calling the second constructor. What could be used to replace /* missing code */ so that this works as intended?

a = 0; b = 0;

this (x, y);

this(0, 0);

x = a; y = b;

a = x; b = y;

_________________

Which of the following correctly implements a mutator method for Point?

public double getX() { return x; } 

public void setCoordinates (double a, double b) { x = a; y = b; } 

None of the items listed.

public double getX() { return a; } 

public void setCoordinates (double a, double b) { Point p = new Point(a,b); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!