Why can you not inherit from a class whose constructor is private?

前端 未结 6 2086
粉色の甜心
粉色の甜心 2020-12-01 13:39

Why does Java disallow inheritance from a class whose constructor is private?

6条回答
  •  长情又很酷
    2020-12-01 13:59

    Yes adding something to Luiggi's answer this feature of java is used when creating the Singleton classes which allows only one instance of that class to be created.

提交回复
热议问题