Why can't we instantiate an abstract class in Java?

前端 未结 16 978
挽巷
挽巷 2020-12-08 05:36

I understand:

  1. Since an abstract class is nothing on its own, e.g. vehicle, we want to create an object of an concrete implementation, like Car, Bike, etc.
16条回答
  •  -上瘾入骨i
    2020-12-08 06:14

    Because an Abstract Class is a skeleton structure(an incomplete construct if you may), hence the term Abstract.

    abstract class Person(){
       abstract void Speak();
    }
    

    Means every Person must speak. That means every person should know how to speak (implement the speak()). new Person() cannot have that, so it is not allowed.

提交回复
热议问题