Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example of a class Main
class Main {
public static void main(String[] args) {
Coordinate pointA = new Coordinate(5.0, 6.0); // (5,6) pointA object is of type Coordinate
Coordinate origin = new Coordinate(0.0, 0.0); // (0,0) origin object is of type Coordinate
System.out.println("abscissa - point A> x: " + pointA.getX() ); // abscissa - point A: 5
System.out.println("abscissa - origin> x: " + origin.getX() ); // abscissa - origin: 0
System.out.println("-- Distance: "+ pointA.distance(origin) ); //result: 7.81
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment