Class Point
- Object
-
- Point
-
public class Point extends Object
Represents an ordered pair of x and y coordinates that define a point in a two-dimensional plane.
-
-
Constructor Summary
Constructors Constructor Description Point(double x, double y)
Initializes a new instance of the Point class with the specified coordinates.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Determines whether the specified object is equal to the current Point.double
getX()
Gets the x-coordinate of this Point.double
getY()
Gets the y-coordinate of this Point.int
hashCode()
Returns the hash code for this Point.String
toString()
Returns a string that represents the current Point.
-
-
-
Method Detail
-
getX
public double getX()
Gets the x-coordinate of this Point.- Returns:
- The x-coordinate.
-
getY
public double getY()
Gets the y-coordinate of this Point.- Returns:
- The y-coordinate.
-
equals
public boolean equals(Object obj)
Determines whether the specified object is equal to the current Point.- Overrides:
equals
in classObject
- Parameters:
obj
- The object to compare with the current Point.- Returns:
- true if the specified object is equal to the current Point; otherwise, false.
-
hashCode
public int hashCode()
Returns the hash code for this Point.- Overrides:
hashCode
in classObject
- Returns:
- A hash code for the current Point.
-
toString
public String toString()
Returns a string that represents the current Point.- Overrides:
toString
in classObject
- Returns:
- A string that represents the current Point.
-
-