class Date
{
private int year;
private int month;
private int day;
public Date(int y, int m, int d) //构造方法
{
year = y;
month = m;
day = d;
}
public void setDate(int y, int m, int d)//设置日期值
{
year = y;
month = m;
day = d;
}
public int getyear()
{
return year;
}
public int getMonth()
{
return month;
}
public int getday()
{
return day;
}
public void Print() //输出日期值
{
System.out.println("date is
"+year+'-'+month+'-'+day);
}
public boolean isLeapYear() //判断是否为闰年
{
return (year%400==0) | (year%100!=0) &
(year%4==0);
}
}
public class Jpro3_11
{
public static void main (String args[])
{
Date a = new Date (2010,10,1);
a.Print();
if(a.isLeapYear())
System.out.println(a.getYear()+"是闰
年");
else
System.out.println(a.getYear()+"不是
闰年");
}
}
找不到符号???红色的部分!
SMILET
慕尼黑8549860
哈士奇WWW
桃花长相依
倚天杖
萧十郎
杨魅力
相关分类