The static public void action () throws ClassNotFoundException {
Int a=1;
If (a & gt; 0 {
Throw new ClassNotFoundException ();//throw class cannot find abnormal}}
Public static void main (String [] args) {
Try {
The action (); }
Catch NullPointerException (e) {//catch null pointer exception e.p rintStackTrace ();
}
}
}
CodePudding user response:
Compile error, checked exception must be captured or throw againCodePudding user response:
The exception thrown is ClassNotFoundException, why a try catch NullPointerException, should also is a ClassNotFoundException capture