singleton.java

来自「深入浅出设计模式」· Java 代码 · 共 19 行

JAVA
19
字号
package headfirst.singleton.subclass;public class Singleton {	protected static Singleton uniqueInstance; 	// other useful instance variables here 	protected Singleton() {} 	public static synchronized Singleton getInstance() {		if (uniqueInstance == null) {			uniqueInstance = new Singleton();		}		return uniqueInstance;	} 	// other useful methods here}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?