Because final variable will be init. when the class is first loaded, and still be there all the time. So, inner class can see this final variable even method is finished.
Ken, You're right First I though it should return "A". Then I try to compile this code and got result "B". Because I miss the line 'as = name()' in class A that make result come out as you explain.
But I think variables are not shadowed. If you change the line 'as = name();' to 'as = "A";' This program will show "A" because attribute member of class cannot be polymophism
I think answer is d: too String "When is a" in c: is on heap and will not be eligible. However, I am not quite sure that "When is a" + first will be on heap?