package com.model;
public class MyData {
private int year;
private int month;
private int day;
public MyData(int year,int month,int day){
this.year=year;
this.month=month;
this.day=day;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public static boolean isLeapYear(MyData data){
int year = data.getYear();
if(year%4==0&&year%100!=0){
return true;
}
if(year%400==0){
return true;
}
return false;
}
public static void main(String[] args) {
MyData data = new MyData(500, 12, 21);
System.out.println(MyData.isLeapYear(data));
}
}
需要的Hi我或者私信我。