File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static method overloading

 
Anvi Dixit
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing wrong with this program.

It will print:

parent
parent
Anvi


You must be making some mistake in calling it.
 
Anvi Dixit
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic