while EOF in JAVA?

后端 未结 7 1404
难免孤独
难免孤独 2020-12-17 06:21

Following to some forums answers I\'m using this:

    while (fileReader.nextLine() != null) {
        String line = fileReader.nextLine();
        System.out         


        
相关标签:
7条回答
  • 2020-12-17 06:49

    nextLine() will throw an exception when there's no line and it will never return null,you can try the Scanner Class instead : http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Scanner.html

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