Results 1 to 12 of 12

Thread: Please Help Beginner Java

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    6

    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!!!!!!!!!!!!!!!!!!!!!!

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    6

    Re: Please Help Beginner Java

    No i see the typo that was me in the posting it says Symbol : VolcanoRobot

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    6

    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.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    6

    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.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.

  9. #9

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    6

    Re: Please Help Beginner Java

    Ok ill go over it all again maybe reinstall.

    Many thanks

  10. #10

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    6

    Re: Please Help Beginner Java

    I have resolved this problem, thanks

  11. #11
    New Member
    Join Date
    Jan 2007
    Posts
    3

    Re: Please Help Beginner Java

    i also like java it's kool

  12. #12
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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
  •  



Click Here to Expand Forum to Full Width