Can we override a constructor in Java and can a constructor be private?

后端 未结 11 1889
旧时难觅i
旧时难觅i 2020-12-29 14:21

I would appreciate an explanation for these questions:

  1. Can we Override a constructor in Java?
  2. Can a Constructor be private?<
11条回答
  •  北荒
    北荒 (楼主)
    2020-12-29 15:16

    Both are not true ,as when a class inherit other class it automatically calls its parents class ,so it makes sense that we can't override and make them final .

提交回复
热议问题