Get the App
SLTechnology News&Howtos  ›  Development  › 

How to check leap years in Java8

Shulou Source: shulou.com Published: 2022-06-01 02:14:03 10月02日 Update

This article mainly introduces how to check leap years in Java8, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.

Checking leap years in Java 8

package com.shxt.demo02; import java.time.LocalDate; public class Demo14 { public static void main(String[] args) { LocalDate today = LocalDate.now(); if(today.isLeapYear()){ System.out.println("This year is Leap year"); }else { System.out.println("2018 is not a Leap year"); } } } Thank you for reading this article carefully. I hope that the article "How to Check Leap Year in Java8" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Tags: Articles leap years check value interest at the same time more friends knowledge editing industry information information channels channels references learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Tech Info Huawei Shulou Technology Docker