What is wrong with this? (trying to follow tutorials)

Discussion in 'Programming General' started by Massive Mage 333, Mar 20, 2007.

What is wrong with this? (trying to follow tutorials)
  1. Unread #1 - Mar 20, 2007 at 7:39 PM
  2. Massive Mage 333
    Joined:
    Jan 21, 2007
    Posts:
    95
    Referrals:
    0
    Sythe Gold:
    0

    Massive Mage 333 Member

    What is wrong with this? (trying to follow tutorials)

    I'm trying to follow the tutorials so I just made something up. I saved the file as heater.java

    I did the javac heater.java thing (I have tried different letter cases)

    Then I typed java Heater (using different cases again)

    I keep getting this error:
    Exception in thread "main" java.lang.NoSuchMethodError: main.

    This is the code, which basically follows the bicycle tutorial, I tried copying and pasting that, but still had the same problem.

    class Heater {

    int power = 0;
    int steam = 0;

    void changePower(int newValue) {
    power = newValue;
    }

    void changeSteam(int newValue) {
    steam = newValue;
    }

    void printStates() {
    System.out.println("power:"+power+" steam:"+steam);
    }
    }

    class Heater1 {
    public static void main(String[] args) {

    //create two heaters
    Heater heat1 = new Heater();
    Heater heat2 = new Heater();

    //methods for the two heaters
    heat1.changePower(3);
    heat1.changeSteam(20);
    heat1.printStates();

    heat2.changePower(1);
    heat2.changeSteam(3);
    heat2.printStates();

    }
    }

    BTW the tabs are where they should be.
     
  3. Unread #2 - Mar 21, 2007 at 7:13 PM
  4. kingpin
    Joined:
    Jan 21, 2007
    Posts:
    1,178
    Referrals:
    0
    Sythe Gold:
    0

    kingpin Guru
    Banned

    What is wrong with this? (trying to follow tutorials)

    hmm i will try to figure something out abot this
     
  5. Unread #3 - Mar 21, 2007 at 8:16 PM
  6. Massive Mage 333
    Joined:
    Jan 21, 2007
    Posts:
    95
    Referrals:
    0
    Sythe Gold:
    0

    Massive Mage 333 Member

    What is wrong with this? (trying to follow tutorials)

    Yeah, I just realized I am a moron. Figured out the problem myself. Please lock.
     
  7. Unread #4 - May 6, 2007 at 8:09 AM
  8. im the pjer
    Joined:
    Apr 29, 2007
    Posts:
    175
    Referrals:
    0
    Sythe Gold:
    0

    im the pjer Active Member
    Banned

    What is wrong with this? (trying to follow tutorials)

    add my msn
     
  9. Unread #5 - May 6, 2007 at 8:09 AM
  10. im the pjer
    Joined:
    Apr 29, 2007
    Posts:
    175
    Referrals:
    0
    Sythe Gold:
    0

    im the pjer Active Member
    Banned

    What is wrong with this? (trying to follow tutorials)

    add me :D
     
  11. Unread #6 - May 6, 2007 at 8:10 AM
  12. im the pjer
    Joined:
    Apr 29, 2007
    Posts:
    175
    Referrals:
    0
    Sythe Gold:
    0

    im the pjer Active Member
    Banned

    What is wrong with this? (trying to follow tutorials)

    why dont u add me >S
     
  13. Unread #7 - May 25, 2007 at 7:30 PM
  14. Doombringe1
    Joined:
    May 19, 2007
    Posts:
    471
    Referrals:
    0
    Sythe Gold:
    0

    Doombringe1 Forum Addict

    What is wrong with this? (trying to follow tutorials)

    Hey what was it that was wrong with the code exactly. When i tryed to go through it i couldnt find anything. Probully because im half asleep. But please tell me because im dieing to know.
     
  15. Unread #8 - May 27, 2007 at 2:44 AM
  16. x⁹
    Referrals:
    1

    x⁹ Guest

    What is wrong with this? (trying to follow tutorials)

    Nothing wrong with the code. It was what he was typing into the console that caused the problem.
     
< Java Newbie - coding | Help, Plz?? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site