Java-Ignore Exception

Ignore Exception

Java does not require any processing of the exception at all. We can simply have a catch statement with an empty block to avoid program termination. Example :

catch(Exception ex);

The catch statement simply ends with a semicolon, which does nothing. This statement will catch an exception and then ignore it.

Program Source

final

Program Source

class Javaapp {

    public static void main(String[] args) {
        
        try{
  
            int a=1/0;
            
        }catch(Exception ex);
        
        System.out.println("Execution Complete");
    }
}

Leave a Comment