Forums Register Login

I got an runtime exception (NoClassDefFoundError) when running this code,but it compiles good.

+Pie Number of slices to send: Send


Hi Friends , can anyone resolve this Problem:


Java identifiers are case sensitive. identifier WELL is differ from Well. but i got a runtime exception while running this program: please tel me why its happened.

Well.java

class WELL
{
WELL()
{
System.out.println("WELL is invoked");
}
}

class Well
{
Well()
{
System.out.println("Well is invoked");
}
public static void main(String...as)
{

new Well();
new WELL();
}
}

+Pie Number of slices to send: Send
I think you cant define same types(classes or interface) in the same package with same name.
As you declared both in one file class loader is having problem identifying the right one even if you will make Well class public.
2
+Pie Number of slices to send: Send
Java is case sensitive, but your OS isn't. In Windows, you can't have two files named WELL.class and Well.class in the same folder.

The code you posted runs just fine under Linux.
+Pie Number of slices to send: Send


i have understood now..

Thank you....Darryl Burke


You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 567 times.
Similar Threads
regarding peer to peer network through java
Exception handling problem
Execute .sql file using java
Method in constant specific class body gets hidden.
ListCellRenderer!!!Help!!
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:52:42.