Tech Study

Java Pogram To Find Distance Between Two Points

Introduction

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

Java Pogram To Find Distance Between Two Points
Java Pogram To Find Distance Between Two Points

TaggedJava Pogram To Find Distance Between Two Points

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more