Infolinks In Text Ads

Oct 8, 2010

Difference NoClassDefFoundException and ClassNotFoundException

NoClassDefFoundException occurs when class is loaded as statically and ClassNotFoundException occurs when class is loaded as dynamically.

Static class loading:-

Car c = new TestClass();

Dynamically class loading:-

According to arun:-

Consider, you have two custom classloaders - CL1 and CL2. A class loaded by CL1 when tried to be accessed by CL2 will also throw a ClassNotFoundException.

And consider you have Class1 loaded by both CL1 and CL2, they both are not compatible even through they are the same. There we give some job to ClassCastException.


No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...