See More

public class Exceptions_03{ public static void main(String[] args){ int i=20,j=0; try{ j=18/i; //Division System.out.println("J ki value 01 : "+j); if (j==0) { throw new ArithmeticException("Manually thrown exception, result of divison is zero"); } System.out.println("J ki value 02 : "+j); } catch(ArithmeticException e){ System.out.println("Automatic Exception catching using catch block"+e); } System.out.println("The value of j after execution of try block is : "+j); } }