The most hard part of question was that
All final automatic variables
Code: Select all
public class TestClass
{
static int si = 10; int ii = 20;
public static void inner()
{
int ai = 30; //automatic variable
final int fai = 40; //automatic final variable
class Inner
{
public Inner() { System.out.println(si+" "+fai); }
}
new Inner();
}
public static void main(String[] args) { TestClass.inner(); }
public static void OtherInnerMethod(){
final int otherFai = 40; // other automatic final variable
}
}
I add other static method and add other automatic final variable.
otherFai can`t be accessed by Inner class.
also i can add declaration of final automation variable after declaration of Inner class.
All instance variables - can be accessed if i create instance of outer class, but not
All automatic final variable can be accessed
How can i resolve such question?