Please Help Beginner Java
Hi just started learning Java and have created a class from a book and a method so it can be run as a program i know the code is correct as i got it from books website.
VolcanoRobot.java
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);
}
}
Volcan Application.java
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();
}
}
When i try and run VolcanoApplication i get the error:
VolcanoApplication.java:3: cannot find symbol
symbol : class VolcanRobot
location : class VolcanoApplication
and then the V in line 3 is highlighted
Please help!!!!!!!!!!!!!!!!!!!!!!
Re: Please Help Beginner Java
Check again the symbol it cannot find. There's a typo in there. The error message ought to be clear enough.
Re: Please Help Beginner Java
No i see the typo that was me in the posting it says Symbol : VolcanoRobot
Re: Please Help Beginner Java
Are the two files in the same directory? Are you calling javac from within that directory or are you giving it the correct source path?
For reference, the error occurs during compiling, not running the program. This is a very important distinction.
Re: Please Help Beginner Java
Both files are in the same directory. I presume im callin javac ok because it compiles RobotClass fine, thanks for your time.
Re: Please Help Beginner Java
I created two files (VolcanoRobot.java and VolcanoApplication.java) and copied the exact thing you posted into them. It compiles and runs fine.
So you must be doing something wrong when compiling them. Can you post exactly your directory layout, what files are in there, and how you call the compiler?
Re: Please Help Beginner Java
JDK is installed at c:\Program Files\Java\JDK1.6.0
Files are at c:\desktop\java\VolcanoRobot.java ect
I compile by typing javac VolcanoApplication.java while in the directory with the files in.
Re: Please Help Beginner Java
Hmm ... I have no 1.6 JDK yet, so maybe something changed there, but I see nothing wrong with your setup. Must be something in the details.
Re: Please Help Beginner Java
Ok ill go over it all again maybe reinstall.
Many thanks
Re: Please Help Beginner Java
I have resolved this problem, thanks
Re: Please Help Beginner Java
i also like java it's kool
Re: Please Help Beginner Java
What an utterly useless post ...