Class Point
java.lang.Object
|
+--Point
- public class Point
- extends java.lang.Object
A point consists of an x-coordinate and a y-coordinate.
These x- and y-coordinate are integers.
Constructor Summary |
Point(int x,
int y)
Creates a point with the specified x- and y-coordinate. |
Method Summary |
double |
distanceTo(Point point)
Returns the distance from this point to the specified point. |
int |
getX()
Returns the x-coordinate of this point. |
int |
getY()
Returns the y-coordinate of this point. |
java.lang.String |
toString()
Returns a string representation of this point. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Point
public Point(int x,
int y)
- Creates a point with the specified x- and y-coordinate.
- Parameters:
x
- the x-coordinate of the point.y
- the y-coordinate of the point.
getX
public int getX()
- Returns the x-coordinate of this point.
- Returns:
- the x-coordinate of this point.
getY
public int getY()
- Returns the y-coordinate of this point.
- Returns:
- the y-coordinate of this point.
distanceTo
public double distanceTo(Point point)
- Returns the distance from this point to the specified point.
- Parameters:
point
- the other point.- Returns:
- the distance from this point to the specified point.
toString
public java.lang.String toString()
- Returns a string representation of this point.
- Overrides:
toString
in class java.lang.Object
- Returns:
- a string representation of this point.