⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 urlgethtmldemo.java

📁 JAVA编程思想源代码 值得一下 很难找的
💻 JAVA
字号:
package chapter15;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

public class URLGetHtmlDemo {

	public static void main(String args[]) {
		URL url = null;
		try {
			url = new URL("http://www.w3c.com");
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
		try {
			InputStream input = url.openStream();
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					input));
			String info = reader.readLine();
			while (info != null) {
				System.out.println(info);
				info = reader.readLine();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -