javac 编译问题(编译程序时出现如图的错误)
classPoint{privatedoublex;privatedoubley;privatedoublez;publicPoint(double_x,double_y...
class Point {
private double x;
private double y;
private double z;
public Point(double _x, double _y, double _z) {
x = _x;
y = _y;
z = _z;
}
public void setX(double _x) {
x = _x;
}
public void setY(double _y) {
y = _y;
}
public void setZ(double _z) {
z = _z;
}
public double length(double x, double y, double z) {
double length;
length = x * x + y * y + z * z;
return length;
}
}
public class TestPoint{
public static void main(String[]args) {
Point p1 = new Point(1, 2, 3);
System.out.println(p1.length);
p1.setX(2);
p1.setZ(2);
System.out.println(p1);
}
} 展开
private double x;
private double y;
private double z;
public Point(double _x, double _y, double _z) {
x = _x;
y = _y;
z = _z;
}
public void setX(double _x) {
x = _x;
}
public void setY(double _y) {
y = _y;
}
public void setZ(double _z) {
z = _z;
}
public double length(double x, double y, double z) {
double length;
length = x * x + y * y + z * z;
return length;
}
}
public class TestPoint{
public static void main(String[]args) {
Point p1 = new Point(1, 2, 3);
System.out.println(p1.length);
p1.setX(2);
p1.setZ(2);
System.out.println(p1);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询