public class day1 {
// 单例饿汉式
private day1(){}
private static day1 c=new day1();
public static day1 day(){
return c;
}
public void ac(){
System.out.println("sss");
}
}
public class day1 {
// 单例懒汉式
private day1(){}
private static day1 c;
public static day1 day(){
if (c==null){
return new day1();
}
return c;
}
public void ac(){
System.out.println("sss");
}
}