这个方法定义出现错误,要怎么改才对呢?
import java.io.InputStreamReader;import java.util.Calendar;
import java.util.Date;
class JspCalendar {
Calendar calendar=null;
public JspCalendar()
{
calendar=Calendar.getInstance();
Date trialTime=new Date();
calendar.setTime(trialTime);
}
public int getEra(){
return calendar.get(Calendar.ERA);
}
public int getAMPM()
{
return calendar.get(Calendar.AM_PM);
}
public int getDSTOffset()
{
return calendar.get(Calendar.DST_OFFSET);
}
public int getZoneOffset()
{
return calendar.get(Calendar.ZONE_OFFSET);
}
public TimeZone getUSTimeZone() //就是这个方法出现错误:E:\JAVA\aa1.java:89: 找不到符号
符号: 类 TimeZone
位置: 类 JspCalendar
public TimeZone getUSTimeZone()
^
1 错误
{
return calendar.getTimeZone();
}
public static void main(String args[])
{
JspCalendar db=new JspCalendar();
p("era:"+db.getEra());
p("ampm:"+db.getAMPM());
p("DST:"+db.getDSTOffset());
p("ZONEOffset:"+db.getZoneOffset());
p("TIMEZONE:"+db.getUSTimeZone());
}
private static void p(String x)
{
System.out.println(x);
}
}
谢谢!!