GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

Why can't we declare classes as static in java ?

I am not talking about nested classes!

asked Dec 7, 2015 by Swanky

2 Answers

 static keyword marks a method or field existing independently of any instance of a class. A class exists once anyway so in effect, all classes are "static" in this way and all objects are instances of classes. 

answered Dec 8, 2015 by Mr.Lazy

At a high level this question deals with the difference between objects and types. While there are many cars (objects), there is only one Car class (type). Declaring something as static means that you are operating in the "type" space. There is only one. The top-level class keyword already defines a type in the "type" space. As a result "public static class Car" is redundant.

answered Dec 26, 2015 by ankit16190