What is static class?
You cannot declare a top-level class as a static class. Java will throw a compilation error. Only inner classes can be declared as static. This is also called as static nested class.
A static nested class is just like a top-level class. Just for packaging purpose we can keep all similar static classes in an outer class.
both are true
A nested class which is declared as static, is called as static class. We can't have a static class as outer class.
Just for packaging convenience we use static classes. Other than this there is no use case.
Back To Top