【发布时间】:2016-07-21 15:01:50
【问题描述】:
我想用下面的公式计算两点之间的距离
如何将其放入代码中以查找距离。
public class Point
{
public int x; // the x coordinate
public int y; // the y coordinate
public Point (int x, int y)
{
this.x=x;
this.y=y;
}
public static double distance (Point p1, Point p2)
{
// to do
return 0.0;
}
public String toString()
{
return "("+x+","+y+")";
}
}
【问题讨论】:
标签: java