1 acd
2 ab
编程
package danli;
public class Dan {
private Dan(){
System.out.println("地球诞生");
}
private static Dan dan=new Dan();
public static Dan dan1(){
return dan;
}
}
package danli;
public class Test {
public static void main(String[] args) {
System.out.println("第一个地球创建中。");
Dan ear1=Dan.dan1();
System.out.println("第2个地球创建中。");
Dan ear2=Dan.dan1();
System.out.println("第3个地球创建中。");
Dan ear3=Dan.dan1();
System.out.println("上地球是同一个吗?");
System.out.println(ear1.dan1());
System.out.println(ear2.dan1());
System.out.println(ear3.dan1());
}
}