Private constructor in abstract class

后端 未结 7 1050
无人及你
无人及你 2020-12-31 05:54

In Java what is the purpose of using private constructor in an abstract class?

In a review I got this question, and I am curious, for what situation we need to use

相关标签:
7条回答
  • 2020-12-31 06:48

    Only thing I can think of is reusing common code shared by the other (protected) constructors. They could then call the private constructor in their first line.

    0 讨论(0)
提交回复
热议问题