Implement a final class without the “final” keyword

后端 未结 7 1698
生来不讨喜
生来不讨喜 2020-12-29 10:53

A friend of mine was asked that question in his on-phone job interview a couple of days a go. I don\'t have a clue. can anyone suggest a solution? (His job interview is ov

7条回答
  •  自闭症患者
    2020-12-29 11:10

    • Mark constructor as private
    • Provide a static method on the class to create instance of a class. This will allow you to instantiate objects of that class

提交回复
热议问题