C#/Basics

Class.인스턴스 메소드와 스태틱 메소드

페프 2021. 4. 25. 20:46
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _03_staticMethod
{
    class Program
    {
        class Date
        {
            public static bool IsLeap(int year)
            {
                if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
                    return true;
                else
                    return false;
            }
        }
        static void Main(string[] args)
        {
            //Date x = new Date(); 

            Console.WriteLine("2021년은 윤년입니다 : {0}", Date.IsLeap(2021));
            Console.WriteLine("2020년은 윤년입니다 : {0}", Date.IsLeap(2020));
        }
    }
}