发布网友 发布时间:2023-06-30 18:02
共1个回答
热心网友 时间:2023-10-12 12:14
import java.util.Scanner; public class test { public static void main (String args[]) { Scanner cs=new Scanner(System.in); System.out.println("请输入月份:"); int input=cs.nextInt(); String season; switch(input) { case 12: case 1: case 2: season="冬季"; break; case 3: case 4: case 5: season="春季"; break; case 6: case 7: case 8: season="夏季"; break; case 9: case 10: case 11: season="秋季"; break; default: season="无效"; } System.out.println(input+"月是"+season); } }