wood burning stoves 2.0*
The moose likes Cattle Drive and the fly likes Pls help with #5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Pls help with #5" Watch "Pls help with #5" New topic
Author

Pls help with #5

sumant suri
Greenhorn

Joined: May 24, 2001
Posts: 8
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

Joined: Mar 28, 2001
Posts: 111
Not really sure but does your main look similiar to this

Amber


"Happiness is a way to Travel, <b>Not</b> a Destination" -- Unknown
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
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).]


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
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

Joined: Jan 08, 2001
Posts: 290
Marylin
I like increasing the font size inside of the code. I'll have to remember that next time.
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
Yeah good one . Never knew you could size=+0 either.
sumant suri
Greenhorn

Joined: May 24, 2001
Posts: 8
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

Joined: May 24, 2001
Posts: 8
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

Joined: Mar 28, 2001
Posts: 111
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

Joined: Mar 28, 2001
Posts: 111
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

Joined: Jul 22, 2000
Posts: 9044
    
  10
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).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pls help with #5
 
Similar Threads
question to Bates on Shift Operators
Pls help with #5
servlets and xml
using javac and java (chapter 10 k&b)
Java compiler