static class in java
问题 How do I declare a static class in java? eclipse wants me to remove "static" from the declaration. static public class Constants { 回答1: First to answer your question: Only a Nested class can be declared static. A top level class cannot declared be static. Secondly, Inner class is a nested class that is not explicitly declared static. See the java language spec. So contrary to some answers here, Inner classes cannot be static To quote an example from the spec: class HasStatic{ static int j =