1986年是不是闰年

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/26 17:45:26
1986年是不是闰年

1986年是不是闰年
1986年是不是闰年

1986年是不是闰年
import java.util.*;
class RN
{ public boolean check(int year)
{
if((year%4 == 0)&&((year%100 != 0)|(year%400 == 0)))
{ return true;
}
else
{ return false;
}
}
}
public class Test
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
RN s=new RN();
System.out.println("Please input year ");
if(s.check(sc.nextInt()))
{ System.out.println("This year is Run Nian");
}
else
{ System.out.println("This year is not Run Nian");
}
}
}
这个是OK的,是不是你没有导入应有的包啊,import java.util.*;
因为Scanner属于util包