final题目,如下:

报错版本如下:
NoSuchElementException error (�read past the end of the input) --> ?? 知道为什么报这个错了 - token五个;这个写法读取的是偶数/pairs,所以读完uw,token已经结束,但是第二个if statement 还在执行 --> 有空再对比正确版本 细排一下流程图/逻辑

修改后能运行版本如下:

似乎是条件判断的问题?在条件判断里call input.next( ) 会advance cursor吗?为什么报错是no such element error? How does the program read past the input???
--------------------
新例子,call scanner method next( ) inside of a if statement, seems it works!
so what is wrong with the previous example?


网友评论