package Demo;
public class Demo1 {
public static void main(String[] args) {
Single s=Single.getInstanceof();
Single s1=Single.getInstanceof();
s.setName("liliang");
String d=s1.getName();
System.out.print(d);
}
}
class Single
{
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static Single getS() {
return s;
}
public static void setS(Single s) {
Single.s = s;
}
private static Single s=new Single();
private Single(){}
public static Single getInstanceof()
{
return s;
}
}