Why are constructors not inherited in java?

后端 未结 12 1281
被撕碎了的回忆
被撕碎了的回忆 2020-11-27 14:24

I am a beginner in java programming language, recently I have studied that constructors can not be inherited in java, Can anyone please explain why<

12条回答
  •  一整个雨季
    2020-11-27 15:22

    No as stated by Mikhail; constructors are not inherited. You cannot inherit a constructor from superclass into your subclass. However when an object is instantiated with the "new" operator in java, that object inherit all constructors from it subclass to it superclass(parent) even including those in abstract class(since they are also super class).

提交回复
热议问题