belongs to collection: Simple Formula Based Java Programs
Java Pogram To Find Distance Between Two Points
In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..
import java.lang.Math.*; class DistanceBwPoint { public static void main(String arg[]) { int x1,x2,y1,y2; double dis; x1=2;y1=2;x2=6;y2=6; dis=Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); System.out.println("distancebetween"+"("+x1+","+y1+"),"+"("+x2+","+y2+")===>"+dis); } }
Result:
distancebetween(2,2),(6,6)===>5.656854249492381
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..
Result:
distancebetween(2,2),(6,6)===>5.656854249492381
need an explanation for this answer? contact us directly to get an explanation for this answer