|
|
|
|
![]() ![]() |
Jun 10 2007, 01:21 AM
Post
#1
|
|
|
Newbie [ Level 2 ] 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.
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 4th December 2008 - 02:04 AM |