我试图通过 URL 获取一些 HTML 并将其放入 String。这是我的努力:
public class
Bank {
public static void main(String[] args) throws IOException {
URL hh = new URL("https://m.hh.ru/");
BufferedReader in = new BufferedReader(
new InputStreamReader(hh.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
inputLine.concat(inputLine);//returns null. WTF?
System.out.println(inputLine);
}
in.close();
System.out.println(inputLine);
}
}
正如我所说我想把它inputLine
,但它返回NULL
。怎么了?