全部文本 #2108398 原始 编辑

Miscellany

公开 java v1 · 不可变
·已发布 2012-01-31 23:21 UTC
渲染后的文本正文
response = reader.readLine();while(response != null) {	response += reader.readLine();}/*Let's walk through what this is doing.First, it's getting a line from reader, and storing it in the variable: response.Then, as long as response (the variable, not the line) is NOT NULL, it is looping.	It is repeatedly adding reader.readLine() to response. Even if reader.readLine() is null, it'll still try to add it.	The variable 'response' will NEVER BE NULL unless the FIRST LINE is null. It'll loop forever./*// Do this instead:response = "";String line = reader.readLine();while (line != null) {	response += line;	line = reader.readLine();}