URL 查看网站数据

package URLConnection;

import java.io.InputStream;
import java.net.URL;
import java.util.Scanner;
/**
 * 查看网站数据
 * @author Administrator
 *
 */
public class URLDemo{
	public static void main(String args[]) throws Exception {	 
		URL url = new URL("http","www.mldnjava.cn",80,"/curriculum.htm") ;
		InputStream input = url.openStream() ;	// 打开输入流
		Scanner scan = new Scanner(input) ;		 
		scan.useDelimiter("\n") ;				// 设置读取分隔符
		while(scan.hasNext()){
			System.out.println(scan.next()) ;
		}
	}
};

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