Suitable for people :java beginner , getting started

New contact java, Learning branch structure if and switch 
package com.ambow.www.ch03; import java.util.Scanner; public class Day {
public static void main(String[] args) { Scanner sc = new Scanner(System.in);
System.out.print(" Please enter the year "); int year = sc.nextInt(); System.out.print(" Please enter month ");
int month = sc.nextInt(); if(month<0 || month>12 || year<0) {
System.out.println(" Please enter the legal month and year !"); }else { switch(month) { case 1: case 3: case
5: case 7: case 8: case 10: case 12:System.out.println("31 day ");break; case 4:
case 6: case 9: case 11:System.out.println("30 day ");break; }
if((year%100!=0&&year%4==0)||year%400==0) { if(month==2) {
System.out.println("29 day "); } }else { if(month==2) { System.out.println("28 day ");
} } } } }
 

Technology
©2019-2020 Toolsou All rights reserved,
Solve in servlet The Chinese output in is a question mark C String function and character function in language MySQL management 35 A small coup optimization Java performance —— Concise article Seven sorting algorithms (java code ) use Ansible Batch deployment SSH Password free login to remote host according to excel generate create Build table SQL sentence Spring Source code series ( sixteen )Spring merge BeanDefinition Principle of Virtual machine installation Linux course What are the common exception classes ?