4 Difference Between NoClassDefFoundError And ClassNotFoundException

NoClassDefFoundError  and ClassNotFoundException. This is one of the questions to increase the knowledge of java exceptions.
We have already shared the 

We will look into the differences , similarities and examples of NoClassDefFoundError and ClassNotFoundException.

Difference between NoClassDefFoundError and ClassNotFoundException

Error vs Exception :  The major difference is in their names. You see that NoClassDefFoundError is Error and derived from LinkageError. It means that NoClassDefFoundError occurs during linking and program can’t run, but compiles successfully.

ClassNotFoundException is Exception and derived fromReflectiveOperationException. 

It occurs during runtime

Irrecoverable vs recoverable:  NoClassDefFoundError refers irrecoverable situation that are not being handled by try/catch/finally block. ClassNotFoundException is checked exception, which requires handling using try/catch/finally block. 

Post a Comment

0 Comments