Here you can find the source of newURL(CharSequence urlString)
public static URL newURL(CharSequence urlString)
//package com.java2s; /*/* w w w.j av a2 s . c o m*/ * SafeOnline project. * * Copyright 2006-2009 Lin.k N.V. All rights reserved. * Lin.k N.V. proprietary/confidential. Use is subject to license terms. */ import java.net.MalformedURLException; import java.net.URL; public class Main { public static URL newURL(CharSequence urlString) { return newURL((URL) null, urlString); } public static URL newURL(URL baseURL, CharSequence relativeURLString) { try { return relativeURLString == null ? baseURL : new URL(baseURL, relativeURLString.toString()); } catch (MalformedURLException e) { throw new RuntimeException(e); } } public static URL newURL(CharSequence baseURL, CharSequence relativeURLString) { return newURL(newURL(baseURL), relativeURLString.toString()); } }