This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* see http://caterpillar.onlyfun.net/Gossip/DesignPattern/SingletonPattern.htm | |
* http://www.jackforfun.com/2007/07/java-synchronized.html | |
*/ | |
public class Singleton { | |
private static Singleton instance = null; | |
private Singleton(){} | |
public static Singleton getInstance() { | |
if (instance == null){ | |
synchronized(Singleton.class){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test{ | |
public String a = "hello"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>发觉自己的爱好!做有意义的事,倾听</h1> |
NewerOlder