class Box
{
// Instance Variables
double length ,ipsos ;
double width ,mikos ;
double height ,platos;
// Constructors
public Box ( double side )
{
width = side ;
height = side ;
length = side ;
}
public Box ( double x , double y , double z)
{
platos = y ;
ipsos = z;
mikos = x ;
}
// Methods
double calculate(double praksi)
{
return 2 * ( width * height +
width * length +
height * length ) ;
}
double volume(double emvadon)
{
return platos*ipsos*mikos ;
}
@Override
public String toString() {
return "Volume: " + volume(1) + "\n Calculate: " + calculate(1);
}
public class Cube extends Box {
public Cube(double side) {
super(side, side, side);
if (side<0) { System.out,println("lathos timi);}
}
}
}
在上面的代码中,编译器发现了一个错误: if (side<0) { System.out,println("lathos timi);}
它说:不是声明
出了什么问题? 我是 Java 编程新手,但现在了解 C 中的“if”。
最佳答案
您的 println 语句中有一个逗号。应该是:
System.out.println("lathos timi");
关于java - 如果在Java中,则不是语句错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22599410/