File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Question on inner classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question on inner classes" Watch "Question on inner classes" New topic
Author

Question on inner classes

shuba gopal
Ranch Hand

Joined: May 12, 2011
Posts: 76


The output printed is "middle". I understand why "inner" will not be printed. Why isnt "outer" printed?
Piyush Joshi
Ranch Hand

Joined: Jun 10, 2011
Posts: 207

Hi

Outer will not be printed because Inner Class A will shadow the outer Class A.

This shadowing is similar to shadowing of the instance variables by local variables with same names.


Piyush
shuba gopal
Ranch Hand

Joined: May 12, 2011
Posts: 76
Piyush, thanks and Welcome to the ranch
shuba gopal
Ranch Hand

Joined: May 12, 2011
Posts: 76


The way size variable is used is an example of shadowing. Am I right?
Piyush Joshi
Ranch Hand

Joined: Jun 10, 2011
Posts: 207

Yes somewhat like that.

More elaborately:


shuba gopal
Ranch Hand

Joined: May 12, 2011
Posts: 76
Thanks Piyush
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on inner classes