import java.util.Scanner; public class A04 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); System.out.print("请输入数字1~7(输入0结束):"); int choice = input.nextInt(); String show = ""; while (choice != 0) { switch (choice) { case 1: show = "今天 是Mon"; break; case 2: show = "今天 是Tue"; break; case 3: show = "今天 是Wed"; break; case 4: show = "今天 是Thu"; break; case 5: show = "今天 是Fri"; break; case 6: show = "今天 是Sat"; break; case 7: show = "今天 是Sun"; break; default: System.out.println("程序错误"); return; } System.out.println(show); System.out.print("请输入数字1~7(输入0结束):"); choice = input.nextInt(); } System.out.println("程序结束!"); }
java-第五章-while-输入1~7,输入0结束循环,输出英文星期的缩写
原创
©著作权归作者所有:来自51CTO博客作者Y幕徐的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
java-第五章-使用while循环输出:100,95,90..................
public class A01 { public static void main(String[] args) { // TODO Auto-generated method stub int num=100; while(num>=5){
java-第五章-使用while循环输出 95 90.................. -
操作系统——第五章 输入输出(I/O)管理
这就是SDT表和DCT表
计算机 数据 数据库 数值 编程语言