Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inner-Outer class problem

 
Abhimanyu Rathore
Ranch Hand
Posts: 32
Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys .. hope you could help again..
i am unable to understand why this prints "Inner" and not "Outer"..




Thanks in advance..
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because Inner class A mask the Outer class A. to access the outer class A, you need to call the class with package name/fully qualified name.
 
Abhimanyu Rathore
Ranch Hand
Posts: 32
Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seetharaman Venkatasamy wrote:because Inner class A mask the Outer class A. to access the outer class A, you need to call the class with package name/fully qualified name.


Thanks Venkat ..
But could you please elaborate.. what do i have to do, to simply invoke "outer go()"..
Thanks in return.. i appreciate..
 
Nick Jariwala
Greenhorn
Posts: 8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This code will invoke "outer go()". You'll have to put your code in a package.

Thanks,
Nikunj Jariwala
http://www.the-tech-talent.com/java
 
Abhimanyu Rathore
Ranch Hand
Posts: 32
Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick Jariwala wrote:

This code will invoke "outer go()". You'll have to put your code in a package.

Thanks,
Nikunj Jariwala
http://www.the-tech-talent.com/java

Thanks a lot Nikunj..
I got the Idea..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic