当我在命令提示符下执行它时,它会给高度找不到符号
的错误class vol {
int height;
int width;
int length;
}
class box {
public static void main(String args[]) {
vol mybox = new vol(); // mybox is created as a object
mybox.height = 10;
System.out.println(height);
}
}
答案 0 :(得分:1)
class Vol {
int height;
int width;
int length;
}
class Box {
public static void main(String args[]) {
Vol mybox = new Vol(); //mybox is created as a object
mybox.height = 10;
System.out.println(mybox.height);
}
}
试试这个。
答案 1 :(得分:0)
问题在于System.out.println(height);
行。它应该是System.out.println(mybox.height);