tianyake
发贴: 4
积分: 0
|
于 2005-03-13 23:21
你太不小心了, import java.net.URL; import java.net.MalformedURLException;
class getURLinfo { public static void main(String args []) { URL url=null; try { url=new URL("http://www.edu.cn/20050311/3130828.shtml"); } catch(MalformedURLException e) { System.out.println("MalformedURLException:"+e); } System.out.println("Protocol:"+url.getProtocol()); System.out.println("Host:"+url.getHost()); System.out.println("Port:"+url.getPort()); System.out.println("File:"+url.getFile()); System.out.println("Ref:"+url.getRef()); } } 这样就行了。在jbuilder2005运行正常
|