Java networking,getting results for my java program to retrieve the URL parts.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   cyril_Anthoni
Posted On:   Friday, June 11, 2004 03:22 AM

import java.net.*; public class getURLParts{ public static void main(String args[]){ for(int i=0;i try{ URL u=new URL("http://www.sun.com"); System.out.println("The URL is" +u); System.out.println("The protocol part is "+u.getProtocol()); System.out.println("The Host part is " +u.getHost()); System.out.println("The Port part is " +u.getPort()); System.out.println("The File part is " +u.getHost()); System.out.println("The ref part is " +u.getRef()); } catch (MalformedURLException e) { System.err.printl   More>>


import java.net.*;

public class getURLParts{

public static void main(String args[]){

for(int i=0;i

try{

URL u=new URL("http://www.sun.com");

System.out.println("The URL is" +u);

System.out.println("The protocol part is "+u.getProtocol());

System.out.println("The Host part is " +u.getHost());

System.out.println("The Port part is " +u.getPort());

System.out.println("The File part is " +u.getHost());

System.out.println("The ref part is " +u.getRef());

}

catch (MalformedURLException e) {

System.err.println(args[0] + "is not a URL I Understand");

}

}

}

}



compiles fine
runs fine saying FINISHED EXECUTING" WITHOUT RETRIEVING THE URL PARTS

   <<Less
About | Sitemap | Contact