首页 > 代码库 > 单例模式

单例模式

package newdemo.jeno.designdemo.utlis;

/**
* Created by songjiabin1 on 2016/9/12.
*/
public class Login {
private static Login instance = null;

public static Login getInstance() {
if (instance == null) {
synchronized (Login.class) {
if (instance == null) {
instance = new Login();
}
}
}
return instance;
}

}

单例模式