What will be the result of attempting to compile and run the following code?
public class Main{ public static void main (String args [] ){ Main obj = new Main (5); } // w w w. ja va 2 s. c o m int m; static int i1 = 5; static int i2 ; int j = 100; int x; public Main (int m){ System.out.println (i1 + " " + i2 + " " + x + " " + j + " " + m); } { j = 30; i2 = 40; } // Instance Initializer static { i1++; } // Static Initializer }
Select 1 option
Correct Option is : C
The value 5 is passed to the constructor to the local (automatic) variable m.
So the instance variable m is shadowed.