java 求大神救命,我小项目找不到BUG,第六个 添加功能之后,每个功能都显示数组越界!!!

2025-03-10 04:58:54
推荐回答(1个)
回答1:

public class MenuControlService {

public void choice() {
Scanner in = new Scanner(System.in);
String choice = in.nextLine();
switch (choice) {
case "1":
new PrintAllCurrentRecords().printAllRecord();
break;
case "2":
new PrintAllCurrentRecordsFormatted().printAllFormatted();
break;
字符串choice可以switch吗?不能的啊