import java.util.Calendar;
class A
{
public static void main(String args[])
{
System.out.println(Calendar.getInstance().MONTH);
}
}
我的电脑输出是:2
你们的呢?
为什么不对?
class A
{
public static void main(String args[])
{
System.out.println(Calendar.getInstance().MONTH);
}
}
我的电脑输出是:2
你们的呢?
为什么不对?
解决方案 »
- Java内部类对象对外部类对象引用的问题.
- JMF远程视频监控,接收端保存为MOV时,运行半小时左右,虚拟机就会退出
- 【帮忙 急。。。】如何得到 CWM(common warehouse metamodel)java API包(100p)
- 有人看过JUST JAVA2没有?
- 学完“JDBC”该学 JAVA 的哪项技术了,如果想开发JSP的程序?JSP还不太熟悉
- 有这样的函数吗?
- string的内容怎么运算?
- 请教问题,win2008服务器,如何才能播放swf文件?
- 对话框Dialog
- 菜鸟求助如何添加键盘监听事件
- if(true == flag){…………}与if (flag == true){…………}的区别
- 求一个求最大素数的程序
java代码:/**
* Field number for <code>get</code> and <code>set</code> indicating the
* month. This is a calendar-specific value. The first month of the year is
* <code>JANUARY</code> which is 0; the last depends on the number of months in a year.
* @see #JANUARY
* @see #FEBRUARY
* @see #MARCH
* @see #APRIL
* @see #MAY
* @see #JUNE
* @see #JULY
* @see #AUGUST
* @see #SEPTEMBER
* @see #OCTOBER
* @see #NOVEMBER
* @see #DECEMBER
* @see #UNDECIMBER
*/
public final static int MONTH = 2;
System.out.println(Calendar.getInstance().get(Calendar.MONTH)+1);
String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000); SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]); Calendar calendar = new GregorianCalendar(pdt); System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
MONTH
public static final int MONTH指示月份的 get 和 set 的字段数字。这是一个特定于日历的值。一年中的第一个月是 JANUARY,它为 0;最后一个月取决于一年中的月份数。
API:
public static final int MONTH 2
你想拿當前月 但為什么去拿個常量呢?
不是取的值不對,而是你取的方法不對。
* <code>JANUARY</code> which is 0; the last depends on the number of months in a year.