try { // 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) { }
try { // 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) { }