urlinfo.java
来自「java课件及例程有一些PPT及一些例程」· Java 代码 · 共 21 行
JAVA
21 行
import java.net.*;
import java.io.*;
import java.util.*;
public class URLInfo{
public static void main(String [] args){
URL theUrl =null;
try{
theUrl = new URL("http://www.bipt.edu.cn:80/index.htm");
}catch(MalformedURLException e){}
System.out.println("protocol is "+theUrl.getProtocol());
System.out.println("host is "+theUrl.getHost());
System.out.println("the File name is"+theUrl.getFile());
System.out.println("port is "+theUrl.getPort());
System.out.println("ref is "+theUrl.getRef());
System.out.println("Query is "+theUrl.getQuery());
System.out.println("path is "+theUrl.getPath());
System.out.println("the user information is "+theUrl.getUserInfo());
System.out.println("Authority is "+theUrl.getAuthority());
System.out.println(Calendar.getInstance().getTime().toString());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?