Java tutorial
import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] argv) { List<URL> urlList = new ArrayList<URL>(); try { urlList.add(new URL("http://www.java2s.com")); } catch (MalformedURLException e) { } String s = urlList.get(0).getHost(); } }