Inner class and static members
Hi, I know that a non-static inner class can not have static members. But the following code compiles successfully and I am confused at it.
class MyOuter
{
MyInner inner = new MyInner();
class MyInner
{
//private static int[] arr1 = new int[2];
//private static int a1 = 5;
//private static final int[] arr2 = new int[2];
private static final int a2 = 5;
}
}
This class compiles successfully though it does not do anything. Here a2 has been declared both static and final and compiler does not object to that whereas if I uncomment any of the commented declarations, the compiler shows errors. Please tell me what is the problem over here.

