|
-
Jan 12th, 2007, 08:46 PM
#1
Thread Starter
New Member
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!!!!!!!!!!!!!!!!!!!!!!
-
Jan 13th, 2007, 07:17 AM
#2
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 13th, 2007, 10:22 AM
#3
Thread Starter
New Member
Re: Please Help Beginner Java
No i see the typo that was me in the posting it says Symbol : VolcanoRobot
-
Jan 13th, 2007, 11:28 AM
#4
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 13th, 2007, 12:13 PM
#5
Thread Starter
New Member
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.
-
Jan 13th, 2007, 04:39 PM
#6
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?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 13th, 2007, 04:55 PM
#7
Thread Starter
New Member
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.
-
Jan 13th, 2007, 07:52 PM
#8
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 13th, 2007, 08:07 PM
#9
Thread Starter
New Member
Re: Please Help Beginner Java
Ok ill go over it all again maybe reinstall.
Many thanks
-
Jan 14th, 2007, 07:18 PM
#10
Thread Starter
New Member
Re: Please Help Beginner Java
I have resolved this problem, thanks
-
Jan 29th, 2007, 08:06 PM
#11
New Member
Re: Please Help Beginner Java
i also like java it's kool
-
Jan 30th, 2007, 03:39 AM
#12
Re: Please Help Beginner Java
What an utterly useless post ...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|