Creating new URLs
1) public URL(String spec) :
- URL u1 = new URL("http://www.cs.nott.ac.uk/~azt/");
2) public URL(String protocol, String host, String file) :
- URL u2 = new URL("http", "www.cs.nott.ac.uk/~azt/", "/java/");
3) public URL(String protocol, String host, int port, String file) :
- URL u3 = new URL("http"," www.cs.nott.ac.uk/~azt ", 80, "/java/");
4) public URL(URL context, String spec) :
- URL u4 = new URL(u, "/java/");
-
If an invalid URL is specified a MalformedURLException is thrown.