Point2D p1 = new Point2D (1.2,2.0);To obtain the distance between two points, we can call distance() method to calculate :
Point2D p2 = new Point2D (3,5);
System.out.println(“The distance between Point2D p1 and p2 is ”+ p1.distance(p2));Remarks
Text provided above does not means is the model answer, and it's was posted here for an reference to somebody who interested the related knowledge only. if there is something incorrect, please leave a comment so that i can correct it or for others viewer to have an better reference, if you want know more about this topic and where is the question, concept or answer from, you can reference from information provided under the reference sub-title.
Reference:
Introduction to Java Programming, Y. Daniel Liang 9.15
No comments :
Post a Comment