Question: output 4- 3 public class Test { public A2 get() { 5 return new A2(); 6 } 7 public static void main(String[] args) { 8-
4- 3 public class Test { public A2 get() { 5 return new A2(); 6 } 7 public static void main(String[] args) { 8- 11[] arr = new 11[] { (new Test().get(), (new A2() { 9 public void m2(int x) { 10 super.m2(x - 1); } 12 }) }; for (11 x : arr) { 14 x.m2(1); } 13 15 16 2e 0 000 wwwww WNNNN on Pow 17) 18 interface 11 { 19 void m2(int x); double x = 3; 21 ) 22 class A2 implements 11 { 23 A2() {} 24 public void m2(int x) { 25 try { 26 if (x / X == 0) 27 throw new Exception("There is error"); System.out.println("The value of x is:" + x); } catch (Exception e) { 30 System.out.println(e.getMessage()); 31 } finally { X++; 33 } 34 System.out.println("The incremented value of x is:" + x); } 36 )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
