Results 1 to 9 of 9
Thread: Need Help please
- 02-22-2012, 11:08 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 4
- Rep Power
- 0
Need Help please
Ok, i am VERY new to java and any type of programming,
After making a hello world application i wanted to do something with variables.
i got the basic code and adapted it so terminal would compile it. here it is
public class VariableTest {
public VariableTest() {
int first, second;
first = 1;
second = 2;
System.out.println ("a is " + first); // 's' in system must be capital
}//end of class
} //end of program
so i compiled it in terminal then i tried running it with "java VariableTest" to which terminal replies
Exception in thread "main" java.lang.NoSuchMethodError: main
and it didnt run my program, can someone tell me what i need to do to fix this?
thanks for reading
ollie
PS i use mac by the way
- 02-22-2012, 11:20 PM #2
Re: Need Help please
Why do they call it rush hour when nothing moves? - Robin Williams
- 02-22-2012, 11:22 PM #3
Member
- Join Date
- Feb 2012
- Posts
- 4
- Rep Power
- 0
- 02-22-2012, 11:29 PM #4
- 02-22-2012, 11:32 PM #5
Member
- Join Date
- Feb 2012
- Posts
- 4
- Rep Power
- 0
Re: Need Help please
nope, i just expected someone to be nice, and point out my mistake. Not provide me with a link as helpful as saying 'google.com'
-
Re: Need Help please
- 02-22-2012, 11:45 PM #7
Member
- Join Date
- Feb 2012
- Posts
- 4
- Rep Power
- 0
Re: Need Help please
ok, now terminla says:
VariableTest.java:2: missing method body, or declare abstract
public static void main(String[] args);
^
1 error
-
Re: Need Help please
Have re-look at that tutorial as that's not how you write a main method. Note that every part has to be perfect as the compiler is very picky. This includes semicolons.
- 02-23-2012, 08:40 AM #9
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks