C:\java\02>javac VolcanoRobot.java
.\VolcanoRobot.java:1: 复制类:Volcanorobot
class Volcanorobot {
^
VolcanoRobot.java:18: 不能解析符号
符号:构造方法 VolcanoRobot ()
位置:类 in VolcanoRobot
VolcanoRobot dante = new VolcanoRobot();
^
VolcanoRobot.java:19: 不能解析符号
符号:变量 status
位置:类 in VolcanoRobot
dante.status="exploring";
^
VolcanoRobot.java:20: 不能解析符号
符号:变量 speed
位置:类 in VolcanoRobot
dante.speed = 2;
^
VolcanoRobot.java:21: 不能解析符号
符号:变量 temperature
位置:类 in VolcanoRobot
dante.temperature = 510;
^
VolcanoRobot.java:23: 不能解析符号
符号:方法 showAttributes ()
位置:类 in VolcanoRobot
dante.showAttributes();
^
VolcanoRobot.java:25: 不能解析符号
符号:变量 speed
位置:类 in VolcanoRobot
dante.speed = 3;
^
VolcanoRobot.java:26: 不能解析符号
符号:方法 showAttributes ()
位置:类 in VolcanoRobot
dante.showAttributes();
^
VolcanoRobot.java:28: 不能解析符号
符号:变量 temperature
位置:类 in VolcanoRobot
dante.temperature = 670;
^
VolcanoRobot.java:29: 不能解析符号
符号:方法 showAttributes ()
位置:类 in VolcanoRobot
dante.showAttributes();
^
VolcanoRobot.java:31: 不能解析符号
符号:方法 checkTemperature ()
位置:类 in VolcanoRobot
dante.checkTemperature();
^
VolcanoRobot.java:32: 不能解析符号
符号:方法 showAttributes ()
位置:类 in VolcanoRobot
dante.showAttributes();
^
12 个错误
class Volcanorobot {
String status;
int speed;
float temperature;
void checkTemperature() {
if (temperature > 660) {
status="returning home";
speed=5;
}
}
void showAttributes() {
System.out.println("Status:" + status);
System.out.println("Speed:" + speed);
System.out.println("Temperature:"+temperature);
}
public static void main(String[] arguments) {
VolcanoRobot dante = new VolcanoRobot();
dante.status="exploring";
dante.speed = 2;
dante.temperature = 510;
dante.showAttributes();
System.out.println("Increasing speed to 3.");
dante.speed = 3;
dante.showAttributes();
System.out.println("Changing temperature to 670.");
dante.temperature = 670;
dante.showAttributes();
System.out.println("Checking the temperature.");
dante.checkTemperature();
dante.showAttributes();
}
}
public class Volcanorobot{ }
-------------------------------------
试了,不行。
Volcanorobot 大小写