Unexpected behavior of Scanner

This question already has an answer here:

  • Close a Scanner linked to System.in 5 answers

  • The reason is quite simple, closing the 1st scanner object closes internally too the input stream which is actually being used by the second scanner

    your options are: use only one scanner or close those when you are sure all of them are not required anymore..

    链接地址: http://www.djcxy.com/p/17222.html

    上一篇: 在Eclipse上运行正常但在SPOJ网站中获得RESULT 0并出现一些错误

    下一篇: Scanner的意外行为