问题描述
- 为什么需要标示符,求大神。在第三行代码,编译时出错。
-
class Point{
double x,y,z;Point(double_x,double_y,double_z ) { x=_x; y=_y; z=_z; } void setX(double _x){ x=_x; } void setY(double _y){ y=_y; } void setZ(double_z){ z=_z; } double getDistance(Point P){ return(x-p.x)*(x-p.x)+(y-p.y)*(y-p.y)+(z-p.z)*(z-p.z); }
}
public class TestPoint{
public static void main(String[]args){
Point p=new Point(1.0,2.0,3.0);
Point p1=new Point(0.0,0.0,0.0);
System.out.println(p.getdistance(p1));p.setX(5.0);在
时间: 2024-09-14 22:19:19