This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pls help with #5

 
sumant suri
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so i wrote out the simple code for a multiplication table ok. I am almost positive that its correct. Now i keep geting the following error when i try and run it:
Exception in thread "main" java.lang.NoSuchMethodError: main
I have been cing this for 2 days now. Somebody help me!!!
It is soo bad that all i have in main is the following line:
System.out.println("hello") and it still did'nt work.
I can put the code up too if u like or just e-mail me and I'll send u the code.
 
Amber Woods
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really sure but does your main look similiar to this

Amber
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You started with this page, right? Did the sample "HelloWorld" compile and run ok?


[This message has been edited by Marilyn deQueiroz (edited May 24, 2001).]
 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for moving this back Marilyn. I acted too hastely by removing it. I should have checked out that #5 referred to assignment Java-5 (Times).
Again my apologies.
For those of you that wont quite understand what I'm about here.
I removed this thread, thinking it did not belong here. Sumant subsequently e-mailed me stating that he was doing the assignments without having them nitpicked. Which means off course that his thread had all right to be here.

[This message has been edited by Johannes de Jong (edited May 24, 2001).]
 
Joseph Russell
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marylin
I like increasing the font size inside of the code. I'll have to remember that next time.
 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah good one . Never knew you could size=+0 either.
 
sumant suri
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I managed to do all the programs till 5 just fine. Now 5 and 6 both give me the same error. I'm positive that my logic is fine 'cause i ran it in C++ and the logic part works just fine.
Originally posted by Marilyn deQueiroz:
[B]You started with this page, right? Did the sample "HelloWorld" compile and run ok?


[This message has been edited by Marilyn deQueiroz (edited May 24, 2001).][/B]

 
sumant suri
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey
the code really looks like
public Times
{
public static void main( )
{
//code in main goes here
}
}
I took the String[] args out because i was not taking an input. LIke all i am supposed to type is : java Times
i dont know if that could be the problem but it did'nt work when i tried it with the String[] args in it.
Sumanth
Originally posted by Amber Woods:
Not really sure but does your main look similiar to this

Amber

 
Amber Woods
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested to see if I could get the error you refered to and I found that I got the error when I capitalized the word main in:
This statement caused the error for me:
public static void Main( String[] args )
This statement didn't:
public static void main( String[] args )
I can't think of anything else could be. Hope that helps
Amber
 
Amber Woods
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just noticed your last post after I just posted.
Anyway, I tested your statement and it does need the String[] args in there otherwise you will get the error you specified.
Amber
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only main() method that the java compiler recognizes is the one that has the String[] args in the parameters. Otherwise it doesn't know where to start.

public static void main( String[] args )

(although Sun knows that you can use other access modifiers like private or protected, the compiler requires everything else in this method signature to work).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic