singleton.java
来自「Head first design pattern这本经典书的 源码」· Java 代码 · 共 21 行
JAVA
21 行
package headfirst.singleton.classic;// NOTE: This is not thread safe!public class Singleton { private static Singleton uniqueInstance; // other useful instance variables here private Singleton() {} public static Singleton getInstance() { if (uniqueInstance == null) { uniqueInstance = new Singleton(); } return uniqueInstance; } // other useful methods here}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?