Modifier static is only allowed in constant variable declarations

You can make the Control class static.

private static class Control {

    // Ok to have static members:
    public static ArrayList<String> keys = new ArrayList<String>();


This is described in the Java Language Specification Section §8.1.3

8.1.3 Inner Classes and Enclosing Instances

An inner class is a nested class that is not explicitly or implicitly declared static. Inner classes may not declare static initializers (§8.7) or member interfaces. Inner classes may not declare static members, unless they are compile-time constant fields (§15.28).

Leave a Comment