Write a Java program to accept a year and check if it is leap year or not.

 6. Write a Java program to accept a year and check if it is leap year or not.

import java.util. *;

class leap{
public static void main(String args[]){
Scanner sc = new Scanner(System.in );
System.out.println("Enter Digits:" );
int n = sc.nextInt();

if (((n % 4 == 0) & & (n % 100 != 0)) | | ( n % 400 == 0)){
System.out.println("leap year");
} else {
System.out.println("not leap year");
}
}
}
Enter Digits:
2020
leap year