标题: Calender类的问题 [打印本页] 作者: 魏亮 时间: 2012-9-26 22:49 标题: Calender类的问题 import java.util.*;
import java.text.*;
class CalendarDemo
{
public static void main(String[] args)
{
Calendar c = Calendar.getInstance();
int index = c.get(Calendar.PM);
int x = c.get(Calendar.DAY_OF_MONTH);
public static void sop(Object obj)
{
System.out.println(obj);
}
}
作者: 罗磊 时间: 2012-9-26 23:42
我用Debug测试!也没看出个所以然来!所以!我也不懂 !一起期待答案吧!作者: 夏天 时间: 2012-9-27 10:29
I don't Know作者: 黑幕 时间: 2012-9-28 19:16
坐等答案作者: 王得新 时间: 2012-9-28 20:14
看了下源代码:
下面是Calendar这个类中定义的部分静态整形常量(观察一下应该能知道文什么了)
public final static int YEAR = 1;
public final static int MONTH = 2;
public final static int WEEK_OF_YEAR = 3;
public final static int WEEK_OF_MONTH = 4;
=================================
public final static int SUNDAY = 1;
public final static int MONDAY = 2;
public final static int TUESDAY = 3;
public final static int WEDNESDAY = 4;
=================================
public final static int PM = 1;
===================================
System.out.println("YEAR....."+c.get(Calendar.YEAR));
System.out.println("MONTH....."+c.get(Calendar.MONTH));
System.out.println("WEEK_OF_YEAR....."+c.get(Calendar.WEEK_OF_YEAR));
System.out.println("WEEK_OF_MONTH....."+c.get(Calendar.WEEK_OF_MONTH));