Non-static inner classes cannot contain static members.
Commentary:
They can if the static variable is also made final.
Is this only for primitive member variables? Attempting to declare a final reference variable in a non-static inner class results in a compiler error, in this case at least:
Code: Select all
import java.util.Date;
class Test{
class Inner{
final static Date date = new Date(); //illegal static declaration
}
public static void main(String[] args){}
}