java.util.NoSuchElementException: No line found

前端 未结 6 858
失恋的感觉
失恋的感觉 2020-11-22 10:17

I got an run time exception in my program while I am reading a file through a Scanner.

java.util.NoSuchElementException: No line found     
   at java.util         


        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 10:41

    You're calling nextLine() and it's throwing an exception when there's no line, exactly as the javadoc describes. It will never return null

    http://download.oracle.com/javase/1,5.0/docs/api/java/util/Scanner.html

提交回复
热议问题