How should I read from a buffered reader?

前端 未结 9 986
無奈伤痛
無奈伤痛 2020-12-06 08:26

I have the following example of reading from a buffered reader:

while ((inputLine = input.readLine()) != null) {
   System.out.println(\"I got a message from         


        
9条回答
  •  被撕碎了的回忆
    2020-12-06 08:56

    But I do not understand how it works. .... waits until something appears in the buffered reader and when something appears there it returns true

    No, it returns the value of the expression (inputLine = input.readLine()), the inputLine itself. The inputLine is compared to null.

提交回复
热议问题