URL toURI Example
URL class toURI example. This example shows you how to use toURI method.
URL class toURI example. public URI toURI() throws URISyntaxException Returns a URI equivalent to this URL. This method functions in the same way as new URI (this.toString()).
Here is the code
/*
* @ # ToURI.java
* A class repersenting use to toURI method
* of URL class in java.net package
* version 24 June 2008
* author Rose India
*/
import java.net.*;
import java.io.*;
public class ToURI {
public static void main(String[] args) throws Exception {
URL url = new URL("http://google.com");
URI uri=url.toURI();
System.out.println(uri.toString());
}
} |
|