Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> What Is Wrong With This?
Simba49
post Jun 10 2007, 01:21 AM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 16
Joined: 10-June 07
From: Fremont, California
Member No.: 22,514



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.

CODE
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.

Notice from WeaponX:
You MUST include the CODE tags whenever you are posting any kind of code, especially if they are chunks of code.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Windows 95 Ibm Aptiva(13)
  2. Cpanel's Sql Estimation Wrong.(0)
  3. Domain Name Wrong And Not Working(2)
  4. What's Wrong With Microsoft?(83)
  5. Death Penalty, Right Or Wrong?(29)
  6. What's Wrong With This Preg_replace Code?(2)
  7. Is It Me Or Something Is Wrong.. Trap17.net Vs....(18)
  8. Wrong Password/username - Fatal Error In Horde(4)
  9. Dating Sims?(16)
  10. Is Button Mashing Wrong?(10)
  11. What's Wrong With Firefox?(5)
  12. Digital Alteration: Creative Or Just...wrong?(6)
  13. Something Wrong With The Points System.(10)
  14. A Question In Game Theory (i Think...)(6)
  15. What's Wrong With This Form?(5)
  1. Cant Access My Cpanel(6)
  2. Tested Out This Guide To Change Ip(2)
  3. Something's Wrong With Myfuturepicks.com(6)
  4. Connecting To Wrong Ftp Address(8)
  5. Infedility... Right Or Wrong?(7)
  6. Whats Wrong With This?(3)
  7. Something Wrong With This Script?(9)
  8. 2 Networks, Wrong One Takes Over(3)
  9. What's Wrong With My Php Webpage?(2)
  10. I Hear A Sound Inside My System Unit.(10)
  11. Whats Wrong In Altec Lansing Sound System ?(5)
  12. What's Wrong?(3)
  13. Something Is Wrong When Linking (dev-c++)(2)


 



- Lo-Fi Version Time is now: 4th December 2008 - 02:04 AM