public final class Point2D extends Object
Point2D
has an
x and a y coordinate.Constructor and Description |
---|
Point2D()
Creates a point with coordinates
(0.0, 0.0) . |
Point2D(double x,
double y)
Creates a point with coordinates
(x, y) . |
Point2D(Point2D other)
Creates a point that has the same coordinates as another point.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compare this point to another object for equality.
|
double |
getX()
Get the x coordinate point.
|
double |
getY()
Get the y coordinate of the point.
|
int |
hashCode()
Computes a hash code for this point.
|
void |
setX(double x)
Set the x coordinate of the point.
|
void |
setY(double y)
Set the y coordinate of the point.
|
String |
toString()
Returns a string representation of the point.
|
public Point2D()
(0.0, 0.0)
.public Point2D(Point2D other)
other
- the Point2D
object to copypublic Point2D(double x, double y)
(x, y)
.public double getX()
public void setX(double x)
x
- the new value for the x coordinatepublic double getY()
public void setY(double y)
y
- the new value for the y coordinatepublic int hashCode()
public boolean equals(Object obj)
true
if and only if the argument is not null
and
is a Point2D
object having the same coordinates as this point.