Java URI.toURL()
Syntax
URI.toURL() has the following syntax.
public URL toURL() throws MalformedURLException
Example
In the following code shows how to use URI.toURL() method.
import java.net.URI;
import java.net.URL;
//from w ww . j a va 2 s. co m
public class Main {
public static void main(String[] args) throws Exception {
URI uri = new URI("http://java2s.com/");
URL url = uri.toURL();
System.out.println(url);
}
}
The code above generates the following result.