Create a URL with a single string in Java
Description
The following code shows how to create a URL with a single string.
Example
/*ww w . j a v a2 s. c o m*/
import java.net.URL;
public class Main {
public static void main(String[] argv) throws Exception {
URL url = new URL("http://hostname:80/index.html");
System.out.println(url);
}
}
The code above generates the following result.