| 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
|
 |
 |
|
|
subject: Question on inner classes
|
|
|