Java下载指定URL的HTML源码,Java实现 输入一URL显示返回的HTML内容?

URL url = new URL("http://www.sina.com.cn");
        InputStream is = url.openStream();
        BufferedReader br = new BufferedReader(new InputStreamReader(is));
        String line = "";
        while (line != null) {
            line = br.readLine();
            System.out.println(line);
        }

 

 

 

 

黑色头发  http://heisetoufa.iteye.com

你可能感兴趣的:(java,html)