What will be the output of the following code? [code] public class Test { public int a=0; class innerClass { public int a=1; void

Kim Trang

New member
What will be the output of the following code?
Code:
public class Test
{
    public int a=0;
    class innerClass
    {
	public int a=1;
	void innermethod(int x)
	{
	    System.out.println(“value of x = ” + x);
	    System.out.println(“value of this.x = ” + this.x);
	    System.out.println(“value of Test.this.x = ” + Test.T=this.x);
	}
    }
}	
public static void main( String args[] )
{
	Test t=new Test();
	Test.innerClass im=t.new innerClass();
	im.innermethod(55);
}
A.
value of x = 55
value of this.x = 0
value of Test.this.x = 1
B.
value of x = 1
value of this.x = 0
value of Test.this.x = 55
C.
value of x = 55
value of this.x = 1
value of Test.this.x = 0
D.
value of x = 0
value of this.x = 55
value of Test.this.x = 1
 

Tìm kiếm

Back
Top