Singleton pattern interview

前端 未结 8 2173
忘了有多久
忘了有多久 2021-02-04 14:26

I am recently asked about java related question in an interview with following code, since I am very new to java and barely code in Java so I really have no idea what the follow

8条回答
  •  盖世英雄少女心
    2021-02-04 14:41

    Through reflection we can create many objects even if the constructor is private.
    In multi-threaded environment there are chances to create more than one instance.
    Through serialization there are chances to create more than one object.

提交回复
热议问题