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'.Computer scienceProgramming languagesJavaAdditional instrumentsEssential standard classesDate and time
LocalDate
Leap Year Check: A Date's True Colors
Report a typo
Sample Input 1:
2020-06-15Sample Output 1:
trueSample Input 2:
2019-03-01Sample Output 2:
falseWrite 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
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.