Trying to read binary file as text but scanner stops at first line

后端 未结 3 1602
野的像风
野的像风 2021-01-27 02:56

I\'m trying to read a binary file but my program just stops at first line.. I think it\'s because of the strange characters the file has..I just want to extract some directions

3条回答
  •  闹比i
    闹比i (楼主)
    2021-01-27 03:44

    Use hasNextLine() instead of hasNext() in the while loop check.

    while (readF.hasNextLine()) {
     String line = readF.nextLine();
     //Your code
     }
    

提交回复
热议问题