我在采访中被问到这个节目问题。
String test = "1 a 10 . 100 sfn 1000";
Scanner scan = new Scanner(test);
int total = 0;
for(int i = 0; i < 4; i++) {
total = total + scan.nextInt(); //not sure if this was the exact line but something like this
}
System.out.println(total);
答案 0 :(得分:-1)
我尝试了替代品,在这里我得到了答案 It will scan first int and print it in console after which exception will be thrown
所以在我的情况下,我有4个选择,1,11,111和1111,所以答案是1。