public class SingletonTest {

private int value;
private static SingletonTest instance;。
private SingletonTest(){
System.out.println("正在执行构造器。。。");
}
public static SingletonTest getInstance(){
if(instance==null){
instance=new SingletonTest();
}
return instance;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}

public static void main(String[]args){
SingletonTest t1=SingletonTest.getInstance();
SingletonTest t2=SingletonTest.getInstance();
t2.setValue(1);
System.out.println(t1==t2);
}

}