import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
public class URLConnectionDemo {
public static void main(String[] args) {
try {
URL url=new URL("http://www.w3school.com.cn/sql/sql_datatypes.asp?name=haha&age=34");
URLConnection conn=url.openConnection();
System.out.println(conn);
InputStream in=conn.getInputStream();
byte[]buf=new byte[1024];
int len=in.read(buf);
System.out.println(new String(buf,0,len));
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}