import java.net.*;
import java.io.*;
class Demo
{
public static void main(String[] args) throws Exception
{
URL url = new URL("http:\\www.baidu.com");
URLConnection uc = url.openConnection();
System.out.println(uc);
InputStream in = uc.getInputStream();
byte[] buf = new byte[1024];
int len = in.read(buf);
System.out.println(new String(buf,0,len));
}
}
每次都跳异常,要怎么改呢?大半夜我已经无力想太多,但是想不出来又睡不着,大家帮帮忙!! |
|