Abstract Class Initialization

女生的网名这么多〃 提交于 2019-12-01 14:38:25

initialization its still giving me an error but why

Because the class is abstract. An abstract class simply can't be instantiated directly, whether or not it's got abstract methods. From the JLS section 8.1.1.1:

It is a compile-time error if an attempt is made to create an instance of an abstract class using a class instance creation expression (§15.9).

If you haven't got any abstract methods and you want to be able to instantiate the class directly, make the class non-abstract. The only reason to make a class with no abstract methods abstract is to force the use of concrete subclasses.

No, you can never instantiate an abstract class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!