File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes static method overloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static method overloading " Watch "static method overloading " New topic
Author

static method overloading

Anvi Dixit
Ranch Hand

Joined: Aug 28, 2006
Posts: 45
Hi all,
First have a look on the code given below:


While running the code i am getting an Exception
'Exception in thread "main" java.lang.NoClassDefFoundError: Main/java
Please explain me why this exception is coming.
Thanks
Anvi
[ October 04, 2006: Message edited by: Barry Gaunt ]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

You've got more mains in there than a pride of lions.

Show us the java command you are using to run the program. Which program are you running. I think you're running the wrong program.

Cheers!

-Cameron www.pulpjava.com
Manu Dhanda
Greenhorn

Joined: Jan 28, 2006
Posts: 23
There is nothing wrong with this program.

It will print:

parent
parent
Anvi


You must be making some mistake in calling it.


"Books are as useful to a stupid person <br />As a mirror is useful to a blind person." <br /> <br />Chanakya quotes (Indian politician, strategist and writer, 350 BC-275BC)
Anvi Dixit
Ranch Hand

Joined: Aug 28, 2006
Posts: 45
Thanks Manu and Kameron

i made the mistake by naming the method as Main and Main1..when i used different names for the methods i got the solution as
parent
parent
Anvi



Thanks
Anvi
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Originally posted by Manu Dhanda:
There is nothing wrong with this program.

It will print:

parent
parent
Anvi


You must be making some mistake in calling it.


That's correct. Anvi, are you typing the command as "java Main.java" instead of just "java Main"?


[ October 04, 2006: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static method overloading