The following program will print 'java.lang.ArithmeticException: / by zero'.
class Test{ //from w ww. jav a 2s.com public static void main (String [] args){ int d = 0; try{ int i = 1 / (d* doIt ()); } catch (Exception e){ System .out.println (e); } } public static int doIt () throws Exception{ throw new Exception ("Forget It"); } }
Select 1 option
Correct Option is : B
It will print Forget It
because before the division can take place doIt () will throw an exception.