Detect months with 31 days

前端 未结 19 1659
南旧
南旧 2020-12-18 01:53

Is there an analogous form of the following code:

if(month == 4,6,9,11)
{
  do something;
}

Or must it be:

if(month == 4 ||         


        
19条回答
  •  醉话见心
    2020-12-18 02:41

    If you're checking if a month has more than 31 days, the simplest way to write it would be (in Java):

     public static boolean hasMoreThan31Days(final int month) {
        return false;
       } 
    

提交回复
热议问题