In the following code for a class in which methodA has an inner class, which variables would the statementin line 8 be able to use in place of XX? [Check all correct answers]
1. public class Base {
2. private static final int ID = 3;
3. private
String name;
4. public void methodA(final int nn ) {
5. int serialN = 11;
6. class inner {
7. void showResult(){
8. System.out.println("Rslt= " + XX );
9. }
10. } // end class inner
11. new inner().showResult();
12. }
13. }
a. The int ID in line 2
b. The String in line 3
c. The int nn in line 4
d. The int serialN in line 5
The correct answers are a , b and c. I thought only c is correct.
If my concept is right, class inner is a local class member (not a inner class member) within the function block, therefore it can only access final variables in that enclosing function. Can anyone tell me why anwser a and b are also correct