Home > Back-end >  Inquire of the following code debugging results. How do you debug
Inquire of the following code debugging results. How do you debug

Time:10-04

Public class Demo {
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 again

CodePudding user response:

The exception thrown is ClassNotFoundException, why a try catch NullPointerException, should also is a ClassNotFoundException capture
  • Related