Chemistry
Chemistry, 05.02.2021 21:50, jen6815

Pertain to the following class, Point: public class Point {
private double x;
private double y;

public Point() {
this (0, 0);
}

public Point(double a, double b) {
/* missing code */
}
// ... other methods not shown
}
Which of the following correctly implements the equals method?

public boolean equals(Point p) {
return (x == p. x && y == p. y );
}
public void equals(Point p) {
System. out. println(x == p. x && y == p. y);
}
public void equals(Point p) {
return (x == p. x && y == p. y );
}
public boolean equals(Point p) {
return (x == Point. x && y == Point. y);
}
public boolean equals(Point p) {
System. out. println(x == p. x && y == p. y);
}


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);
}

answer
Answers: 1

Other questions on the subject: Chemistry

image
Chemistry, 22.06.2019 04:00, kim95207
What layer of the atmosphere is directly above the troposphere?
Answers: 1
image
Chemistry, 22.06.2019 10:00, ellaemtagedeane
Nonpoint source pollution is difficult to control because it
Answers: 2
image
Chemistry, 22.06.2019 15:30, angie249
The identities of substances are the same before and after which type of change
Answers: 1
image
Chemistry, 23.06.2019 05:00, dhhdndnd
What is the relationship between particles in matter
Answers: 3
Do you know the correct answer?
Pertain to the following class, Point: public class Point {
private double x;
private...

Questions in other subjects:

Konu
Mathematics, 18.08.2020 20:01