我正在尝试编写一个Calendar输出html带有Calendar内部表的网页的java ,但是在尝试获取特定年份中特定月份的天数时遇到了问题.
这是我正在使用的一些代码:
//accept input from command prompt in form of MONTH, DAY, YEAR
String date = args[0];
SimpleDateFormat df = new SimpleDateFormat("MMMM dd, yyyy");
Date convertedDate = new Date();
try
{
convertedDate = df.parse(date);
}
catch(Exception e)
{
System.out.print(e);
}
Calendar cal = Calendar.getInstance();
cal.setTime(convertedDate);
year = cal.get(Calendar.YEAR);
month = cal.get(Calendar.MONTH);
day = cal.get(Calendar.DAY_OF_MONTH);
//get number of days in month
int numDays, startMonth;
numDays = cal.getActualMaximum(DAY_OF_MONTH);
Run Code Online (Sandbox Code Playgroud)
我从最后一行看到的错误是:
error: cannot find symbol and it …