Java examples for Network:URL
Creating a URL
import java.net.MalformedURLException; import java.net.URL; public class Main { public static void main(String[] args) throws Exception { try {/*from www. ja va2 s . c o m*/ // With components. URL url = new URL("http", "hostname", 80, "index.html"); // With a single string. url = new URL("http://hostname:80/index.html"); } catch (MalformedURLException e) { } } }