Answer:
public class Point
{
public int x;
public int y;
Point(int x,int y)
{
this.x=x;
this.y=y;
}
public static void main(String[] args)
{
Point p1=new Point(-2,3);
Point p2=new Point(3,-4);
System.out.println("distance:"+distance(p1,p2));
}
private static double distance(Point p1,Point p2)
{
return Math.sqrt(Math.pow(p2.x-p1.x, 2)+Math.pow(p2.y-p1.y, 2));
}
}
Explanation:
The java program defines the Point class and the public method 'distance' to return the total distance between the two quadrants passed to it as arguments (they are both instances of the Point class).