1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Update JavaConcurrencyAdvancedCommonInterviewQuestions.md

This commit is contained in:
shuang.kou 2020-05-16 15:31:26 +08:00
parent e099364b31
commit 767e712351

View File

@ -73,7 +73,7 @@ public class Singleton {
private Singleton() {
}
public static Singleton getUniqueInstance() {
public synchronized static Singleton getUniqueInstance() {
//先判断对象是否已经实例过,没有实例化过才进入加锁代码
if (uniqueInstance == null) {
//类对象加锁