【文件属性】:
文件名称://构造URL对象-JAVA自学教程(史上最全)
文件大小:9.22MB
文件格式:PPT
更新时间:2021-04-25 23:17:20
JAVA
//构造URL对象
URL currenturl = new URL(urlstring);
urlstring = currenturl.toString();
//判断是否是HTTP协议
if(!currenturl.getProtocol().equals("http"))
{
status = currenturl.getProtocol() + " protocol";
}
else
{
//打开连接
URLConnection conn = currenturl.openConnection();
//建立HttpURLConnection对象