// Demonstrate URL import java.net.*; class patrickURL { public static void main(String args[]) throws MalformedURLException { URL hp = new URL("ftp://ftp.cdac.com:21"); System.out.println("Protocol: " + hp.getProtocol()); System.out.println("Port: " + hp.getPort()); System.out.println("Host: " + hp.getHost()); System.out.println("File: " + hp.getFile()); System.out.println("Ext: " + hp.toExternalForm()); } }