different behaviour of input scanner and parse in android studio and netbeans

前端 未结 1 1469
被撕碎了的回忆
被撕碎了的回忆 2021-01-26 04:58

I am reading the same pipe-delimited file using NetBeans (to test the basic code) and Android Studio (actual application) and getting different results.

Here is the off

1条回答
  •  温柔的废话
    2021-01-26 05:26

    Looks like the problem is in using hasNext() in the header of for loop and using nextLine() in the body of for loop. When I replaced hasNext() with hasNextLine(), my record counts matched. Don't understand why, since hasNext() is supposed to look at something, not change, but it worked.

    0 讨论(0)
提交回复
热议问题