未验证 提交 d223864a 编写于 作者: S SnailClimb 提交者: GitHub

Merge pull request #822 from huangshangi/master

Update the singleton pattern example
......@@ -73,7 +73,7 @@ public class Singleton {
private Singleton() {
}
public synchronized static Singleton getUniqueInstance() {
public static Singleton getUniqueInstance() {
//先判断对象是否已经实例过,没有实例化过才进入加锁代码
if (uniqueInstance == null) {
//类对象加锁
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册