请问如下java程序的错误 报Exception in thread "main" java.util.NoSuchElementException
importjava.util.*;publicclasscase_of_test{publicstaticvoidmain(String[]args){intkey=1...
import java.util.*;
public class case_of_test {
public static void main(String[] args){
int key = 1;
while (key != 0){
Scanner input = new Scanner(System.in);
System.out.println("input option");
key = input.nextInt();
input.close();
switch (key) {
case 1:{System.out.println(key);break;}
case 2:{System.out.println(key);break;}
case 3:{System.out.println(key);break;}
case 0:break;
}
}
}
} 展开
public class case_of_test {
public static void main(String[] args){
int key = 1;
while (key != 0){
Scanner input = new Scanner(System.in);
System.out.println("input option");
key = input.nextInt();
input.close();
switch (key) {
case 1:{System.out.println(key);break;}
case 2:{System.out.println(key);break;}
case 3:{System.out.println(key);break;}
case 0:break;
}
}
}
} 展开
6个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询