Mega Code Archive

 
Categories / Java Tutorial / Network
 

Relative URL

import java.net.MalformedURLException; import java.net.URL; public class MainClass {   public static void main(String[] a) {     try {       URL base = new URL("http://www.rntsoft.com/");       URL relative = new URL(base, "index.html");       System.out.println(relative);     } catch (MalformedURLException ex) {       ;     }   } } http://www.rntsoft.com/index.html