1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| package com.sympa.lesson01;
import java.io.IOException; import java.net.URL;
public class URLTest {
public static void main(String[] args) {
try{ URL url = new URL("file:///F:/jdbc/02.jpg"); System.out.println(url.getProtocol()); System.out.println(url.getHost()); System.out.println(url.getPort()); System.out.println(url.getPath()); System.out.println(url.getFile()); System.out.println(url.getQuery());
} catch (IOException e){ e.printStackTrace(); } } }
|