日期:2014-05-20 浏览次数:20622 次
public class DateUtil {
public static Date getNow(){...}
}
public class A {
DateUtil.getNow();
...
C c = new C();
D d = new D();
}
public class C {
DateUtil.getNow();
}
public class D {
DateUtil.getNow();
}
public class DateValue {
private Date date;
//get与set方法
public int getMonth(){...}
}
public class A {
//从某处获得DateValue,或者自己创建
int month = dateValue.getMonth();
C c = new C(dateValue);
D d = new D(dateValue);
}
public class DateUtil {
public static int getMonth(Date date){...}
}
public class A {
C c = new C();
D d = new D();
c.方法(date);
d.方法(date);
}
public class C {
public 方法(date){ DateUtil.getMonth(date);
}
public class D {
public 方法(date){ DateUtil.getMonth(date);
}