java.util包中的Calendar类
class Calendar {
private Calendar calendar = new Calendar();
private Calendar {};
public static synchronized Calendar getInstance(){
return calendar;
}
}
这是public class Calendar {
private Calendar calendar = new Calendar();
private Calendar {};
public static synchronized Calendar getInstance(){
return calendar;
}
}
这是Calendar 类的定义,因此要定义Calendar 类的实例对象,这能使用此方法。