Why can't a top level class be static in Java?

前端 未结 8 1356
礼貌的吻别
礼貌的吻别 2020-12-04 07:30

Can\'t find a satisfactory answer anywhere.

8条回答
  •  情歌与酒
    2020-12-04 08:03

    Whenever we run a class JVM instantiates an object. JVM can create a number of objects, by definition Static means you have same set of copy to all objects.So, if top class is static then whenever you run a program it creates an Object and keeps over riding on to the same Memory Location.

提交回复
热议问题