32. ? һURL Ҫ֣
C ЭʶHTTPFTPFile
C Դ֣ļ˿ںţ
? 磺
? http://java.sun.com:80/docs/books/tutorial/index.
html#DOWN
33. ? URL
C JavaУԴʾURLַURL
URLʾһURLַURL
þURLURLͲURL
34. ? URL
C 磺http://www.gamelan.com/pages/index..html
C new
URL("http://www.gamelan.com/pages/index.html");
C URL gamelan = new
URL("http://www.gamelan.com/pages/");
C URL gamelanGames = new URL(gamelan,
"game.html");
C new URL("http", "www.gamelan.com",
"/pages/index.html");
C new URL("http", "www.gamelan.com", 80,
"pages/index.network.html");
35. ? URL
C ʧܣ
C try
C {
C URL myURL = new URL(. . .)
C } catch (MalformedURLException e)
C {
C . . .
C // exception handler code here
C . . .
C }
36. ? μ Url1.java
C URLĸ
C getProtocol
C getHost
C getPort
C getFile
C getRef
41. ?
C InetAddress ûԵĹ캯Ϊһ
InetAddressһõĹ
C factory methodһо̬
һʵԼ
InetAddress getLocalHost( )
getByName( )ԼgetAllByName( )
InetAddressʵ
42. C static InetAddress getLocalHost( )
C throws UnknownHostException
C static InetAddress getByName(String
hostName)
C throws UnknownHostException
C static InetAddress[ ]
getAllByName(String hostName)
C throws UnknownHostException