网站建设 m.ykn.cc,wordpress英文升级为中文,百度入口网站,达州市建设规划网站public class text9 {/*在实际开发中#xff0c;如果我们需要在多种情况中选择其中一个,就可以用switch语句。当我m们拨打电话#xff0c;会有一些按键选择。假设我们拨打了一个机票预订电话#xff0c;电话中提示#xff1a;1机票查询2机票预订3机票改签4退出服务其他按键…public class text9 {/*在实际开发中如果我们需要在多种情况中选择其中一个,就可以用switch语句。当我m们拨打电话会有一些按键选择。假设我们拨打了一个机票预订电话电话中提示1机票查询2机票预订3机票改签4退出服务其他按键也是退出服务用switch语句来模拟该逻辑*///键盘录入该按键选择public static void main(String[] args) {Scanner sc new Scanner(System.in);System.out.println(请输入您的选择);int numbersc.nextInt();//根据按键选择不同的服务switch (number){case 1:System.out.println(机票查询);break;case 2:System.out.println(机票预订);break;case 3:System.out.println(机票改签);break;case 4:System.out.println(退出服务);break;default:System.out.println(退出服务);break;}}}