[JAVA] Judgment of the calendar

Create a program to judge the calendar.

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int reki = sc.nextInt();
        String hantei = "";
        if(reki%4==0){
            hantei="leap year";
            if(reki%400!=0 && reki%100==0){
                hantei="Normal year";
            }else{
                hantei="leap year";
            }
        }else{
            hantei="Normal year";
        }
        System.out.println(hantei);
    }
}

//If you enter 1900, it will be normal
//Enter 2000 to get a leap year
//If you enter 2001, it will be normal
//Enter 2004 to get a leap year

Recommended Posts

Judgment of the calendar
The world of clara-rules (2)
The world of clara-rules (4)
The world of clara-rules (1)
The world of clara-rules (3)
The world of clara-rules (5)
The idea of quicksort
The idea of jQuery
Docker monitoring-explaining the basics of basics-
Inclusion judgment of elements of Collection
About the description of Docker-compose.yml
Understand the basics of docker
The play of instantiating java.lang.Void
Judgment of JSONArray and JSONObject
Explanation of the FizzBuzz problem
The basics of Swift's TableView
Median of the three values
The illusion of object orientation
Judgment of fractions in Ruby
Switch the version of bundler
Was done in the base year of the Java calendar week
About the behavior of ruby Hash # ==
[Java] Delete the elements of List
Continuation: The parable of OOP (omitted)
Qualify only part of the text
Understand the basic mechanism of log4j2.xml
About the basics of Android development
'% 02d' What is the percentage of% 2?
[Java version] The story of serialization
Check the version of Cent OS
[Swift] Change the textColor of UIDatePicker
[Ruby] See the essence of ArgumentError
Explanation of the order of rails routes
I read the source of ArrayList I read
The basics of SpringBoot + MyBatis + MySQL
Note on the path of request.getRequestDispatcher
First launch judgment of Android application
The basic basis of Swift dialogs
Want to know what Ruby n is the power of 2? (Power judgment of 2)
The basic basis of Swift's Delegate
I read the source of Integer
This and that of the JDK
Check the migration status of rails
The story of @ViewScoped consuming memory
Filter the fluctuations of raw data
Explaining the columns of Spree :: Taxonomy
A memorandum of the FizzBuzz problem
I read the source of Long
Official logo list of the service
[Apache POI] Judgment of unnecessary cells
Explain the column of Spree :: Product
Various methods of the String class
About the role of the initialize method
[Java] Judgment of identity and equivalence
Think about the 7 rules of Optional
Get the ID of automatic numbering
I read the source of Short
I read the source of Byte
Order of processing in the program
I read the source of String
The origin of Java lambda expressions