Question
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
Posted under Object Oriented Programming
value of this.x = 1
value of Test.this.x = 0
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What will be the output of the following code?
Similar Questions
Discover Related MCQs
Q. Instance of inner class can exist only _______________ enclosing class.
View solution
Q. If a declaration of a member in inner class has the same name as that in the outer class, then ________________ enclosing scope.
View solution
Q. A static nested class is _____________ class in behavior that is nested in another _________ class.
View solution
Q. Which among the following best defines static variables members?
View solution
Q. Which keyword should be used to declare static variables?
View solution
Q. Any changes made to static data member from one member function _____________
View solution
Q. Which is the correct syntax for declaring static data member?
View solution
Q. The static data member ______________________
View solution
Q. The syntax for defining the static data members is:
View solution
Q. If static data members have to be used inside a class, those member functions _______________
View solution
Q. The static data member __________________________
View solution
Q. Which among the following is correct syntax to access static data member without using member function?
View solution
Q. Which data members among the following are static by default?
View solution
Q. Whenever any static data member is declared in a class ______________________
View solution
Q. If object of class are created, then the static data members can be accessed ____________
View solution
Q. Which among the following is wrong syntax related to static data members?
View solution
Q. Which among the following is correct definition for static member functions?
View solution
Q. The static member functions __________________
View solution
Q. The static member functions ____________________
View solution
Q. Which is correct syntax to access the static member functions with class name?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!