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 个错误

解决方案 »

  1.   

    源码:
    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();
          }   
    }
      

  2.   

    -------------------------------------
       public class Volcanorobot{   }
    -------------------------------------
    试了,不行。
      

  3.   

    http://www.cadenhead.info/book/21javapre/source/chapter02/VolcanoRobot.java上有同样的原码,就是他们出的书。
      

  4.   

    你的类的文件名不是Volcanorobot!!!!!!!名字一定要相同!!!!!
      

  5.   

    VolcanoRobot
    Volcanorobot 大小写