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[] argsthrows Exception {

        URL url = new URL("http://google.com");
        URI uri=url.toURI();
        System.out.println(uri.toString());
    }
}

Output
http://google.com

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US