See More

class AdityaException extends Exception{ public AdityaException(String str) { super(str); } } public class Exceptions_04{ public static void main(String[] args){ int i=20,j=0; try{ j=18/i; if(j==0) { throw new AdityaException("The answer of division is zero"); } } catch(AdityaException a) { System.out.println(a); } catch(Exception e) { System.out.println(e); } } }