java判断闰年是否

为什么我写的y的限制没有用啊?

img

感谢采纳,有问题可以继续交流!
if (y< 1990 || y > 2050){ //这里应该用或,与的话,不可能存在的,所有不管用


import java.util.Scanner;

public class test4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int y = sc.nextInt();

        if (y< 1990 || y > 2050){ //这里应该用或,与的话,不可能存在的,所有不管用
            System.out.println("1990=<y<=2050");
        }else if(y % 4 == 0 && y % 100 != 0 || y % 400 == 0){
            System.out.println("yes");
        }else {
            System.out.println("no");
        }

    }
}

把并且改成或者
y怎么可能同时小于1990又大于2050呢

方法一:
public class Bissextile {
boolean bissextile(int year){ //创建boolean类型的方法
if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0){ //平闰年判断算法
return true;
}
else{
return false;
}
}
方法二:

java.util.GregorianCalendar.isLeapYear(int year) 方法确定给定年份是否为闰年。如果给定的年份是闰年返回true。

img