Can we declare a class as static in Java?

Java doesn't allow you to create top-level classes as static. You can only make a nested class as static . By doing so, you can use the nested class without having an instance of the outer class. In order to create a nested class as static, you basically are saying that you don't need an instance of the nested class to use it from your outer class/top-level-class. Nested static class doesn’t need reference of Outer class, but Non-static nested class or Inner class requires Outer class reference. Example
class OuterClass { static class StaticNestedClass { //its member variables and methods (don't necessarily need to be static) //but cannot access members of the enclosing class } public void OuterMethod(){ //can access members of nestedStaticClass w/o an instance } }

Static nested classes are accessed using the enclosing class name:

OuterClass.StaticNestedClass