摘要: switch选择结构 多选择结构还有一个实现方式就是switch case语句 switch语句中的变量类型可以是: byte、short、int或者char 从Java SE7开始 switch支持字符串String类型了 同时case标签必须为字符串常量或字面量 例子:输入成绩匹配对应等级 定义 阅读全文
posted @ 2022-08-10 11:11 Fred不想做咸鱼 阅读(39) 评论(0) 推荐(0)
摘要: 顺序结构里的if语句 Scanner scanner = new Scanner(System.in); System.out.println("请输入内容:"); String s = scanner.nextLine(); //equals:判断字符串是否相等 if (s.equals("hel 阅读全文
posted @ 2022-08-10 10:53 Fred不想做咸鱼 阅读(58) 评论(0) 推荐(0)