import java.util.Scanner; public class switch_case { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("输入当前星期:"); int i = scanner.nextInt(); switch (i){ case 1: System.out.println("星期一"); break; case 2: System.out.println("星期二"); break; case 3: System.out.println("星期三"); break; case 4: System.out.println("星期四"); break; case 5: System.out.println("星期五"); break; case 6: System.out.println("星期six"); break; case 7: System.out.println("星期天"); break; default: System.out.println("shabi"); break; } } }
一个简单的java代码,输入当前星期,输出今天是星期几
最新推荐文章于 2024-09-17 22:37:48 发布