View Single Post
Old 05-24-2012, 07:20 PM   PM User | #1
Jemdt
New Coder

 
Join Date: May 2012
Posts: 29
Thanks: 2
Thanked 0 Times in 0 Posts
Jemdt is an unknown quantity at this point
Java file will not compile

Hi, I'm completely brand new to Java, and have been learning from the books.

In one of the book exercises, I was supposed to copy and paste two scripts (VolcanoApplication.java & VolcanoRobot.java) and compile VolcanoApplication.java so I could run the program. Unfortunately, whenever try to compile VolcanoApplication.java in Cmd (Javac C:\ etc.), no class file is created and I get this error message:



I copied the code exactly from the book:

VolcanoApplication.java:

Code:
class VolcanoApplication {
   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();
    }
}
VolcanoRobot.java

Code:
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);
       }
    }
I'm sure there must be a simple fix for this, but as I'm completely new to Java, I have no idea what to do. Please help!

Thanks

James
Jemdt is offline   Reply With Quote