我被卡住了,无法弄清楚为什么我的输入扫描仪挂起,等待新的输入。谁能看到我错过了什么或没有做什么?我知道这很愚蠢,谢谢!
while (more == true){
str = "";
val = "";
System.out.println("Enter a Constructor argument type : ");
try {
str = input.nextLine();
} catch (Exception e) {
more = false; input.close();
}
if ( str.isEmpty() || str.equals("") || (str == null) ) {
more = false;
}
else{
arguments.add(str);
System.out.println("Enter it's value : ");
try {
val = input.nextLine();
} catch (Exception e) {
more = false;
}
if ( val.equals("") || (val == null) || val.isEmpty() ) {
more = false;
}
else{
values.add(val);
}
}
}