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.
Static nested classes are accessed using the enclosing class name: