Leap Year Check: A Date's True Colors

Report a typo
Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
Write a Java program that accepts a date in 'YYYY-MM-DD' format and prints 'true' if the year of the registered date is a leap year, otherwise 'false'.

Sample Input 1:

2020-06-15

Sample Output 1:

true

Sample Input 2:

2019-03-01

Sample Output 2:

false
Write a program in Java 25
import java.time.LocalDate;

public class Main {
public static void main(String[] args) {
// Add `LocalDate` object creation here

// Check if the year from the date is a leap year

// Print `true` or `false` based on the result
}
}

Create a free account to access the full topic