Run-time exceptions and check-time exceptions

The exception is a syntax error or logic error during inspection

The runtime exception compiler does not check but it will affect the execution of the code behind during execution

1. Runtime exception classification (RuntimeException):

1.NullPointerException: Null Pointer Exception

2.ArithmeticException: Mathematical exception

3.ArrayIndexOutOfBoundsException: The array is out of bounds

4.SecurityException: Security exception

5. IllegalArgumentException: Illegal parameter exception

6.ArrayStoreException: Array member type exception

7.NegativeArraySizeException: Negative length array

2. Exception handling try...catch statement:

public class Fire {     public static void main(String[] args) {         try {             System.out.println(1/0);         }catch(Exception t){             System.out.println(t);//output error type         } finally {//Regardless of whether there is an error, it will execute             System.out.println("Definitely execute");         }     }
    

        







}

 

 

 

 

Guess you like

Origin blog.csdn.net/SignalFire/article/details/105428399