Skip to content

Instantly share code, notes, and snippets.

@mayararysia
Last active August 21, 2020 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayararysia/71e6755ab657936f79fc6a30f1c388ad to your computer and use it in GitHub Desktop.
Save mayararysia/71e6755ab657936f79fc6a30f1c388ad to your computer and use it in GitHub Desktop.
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