0
我尝试读取一个int和之后的字符串,这样:它打印爪哇 - 读字符串和int:java.util.NoSuchElementException
Save? Press 1 for yes, or 0 for no
String wantA = ""; Scanner in = new Scanner(System.in); System.out.println("Enter A"); wantA = in.nextLine(); in.close(); // some code int want = 0; Scanner in = new Scanner(System.in); System.out.println("Save? Press 1 for yes, or 0 for no"); want = in.nextInt(); in.close();
后
然后我得到
java.util.NoSuchElementException
我该如何解决?
@deporter点丢失了怎么办?为什么downvote? – Bohemian 2012-02-24 09:34:40