What is the output of the following code.
class Enclosing { void m(final int x) { final int y = x*2; class Enclosed { int a = x; int b = y; } Enclosed ec = new Enclosed(); System.out.println(ec.a); System.out.println(ec.b); } } public class Main { public static void main(String[] args) { Enclosing ec = new Enclosing(); ec.m(10); System.out.println(Math.abs(-1)); } }
10 20 1
class Enclosing { void m(final int x) { final int y = x*2; class Enclosed { int a = x;//from w ww .ja v a 2 s. c o m int b = y; } Enclosed ec = new Enclosed(); System.out.println(ec.a); System.out.println(ec.b); } } public class Main { public static void main(String[] args) { Enclosing ec = new Enclosing(); ec.m(10); System.out.println(Math.abs(-1)); } }