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

ansver
Answers: 1

Another question on Chemistry

question
Chemistry, 22.06.2019 06:00
When a spring is compressed, the energy changes from kinetic to potential. which best describes what is causing this change?
Answers: 3
question
Chemistry, 22.06.2019 09:30
The chart shows the bid provided by four contractors to complete a job. which contractor is the most cost-effective?
Answers: 3
question
Chemistry, 22.06.2019 19:00
Sum of brother and sisters age is 26. four times the brothers age is subtracted from three times the sisters age, the difference is 8. what are the ages of the brother and sister?
Answers: 1
question
Chemistry, 22.06.2019 21:00
The rate constant for the reaction below is 6.2 x 10−5 mol l−1 s −1. if the initial concentration of a is 0.0500 m, what is its concentration after 115 s?
Answers: 1
You know the right answer?
Pertain to the following class, Point: public class Point {
private double x;
private...
Questions
question
Mathematics, 19.11.2020 22:40
question
Mathematics, 19.11.2020 22:40
question
Mathematics, 19.11.2020 22:40
Questions on the website: 13722363