what is the output ? how is the parameter that generates an exception being passed as an argument in a method ??? Question ID :957921513300 What will be the output of the following program ? class Test { static int i1, i2, i3; public static void main(String[] args) { try { test(i1 = 1, oops(i2=2), i3 = 3); } catch (Exception e) { System.out.println(i1+" "+i2+" "+i3); } } static int oops(int i) throws Exception { throw new Exception("oops"); } static int test(int a, int b, int c) { return a + b + c; } }
Tarik Makota
Greenhorn
Joined: Jan 29, 2002
Posts: 23
posted
0
the return value of oops is sent!!! first i2=2 is executed and then function oops is called. Return value of oops will be used but it throws exception so you bail out.