|
|
|
|
The InetAddress class encapsulates Internet addresses. It supports both host names and IP addresses. InetAddress is a somewhat unusual class, because it has no public constructors. To get an instance of InetAddress, you use one of the static methods in the class. To learn about the details of the InetAddress class, click here. InetAddress ExampleHere's an example program that uses the InetAddress class to perform a lookup on a specified host.
If you ask it to look up the host www.rivier.edu, it will output: Host name : www.rivier.edu IP address: 66.251.112.2 If you ask it to look up localhost, it will output: Host name : localhost IP address: 127.0.0.1 If you ask it to look up 127.0.0.1, it will output the same as for localhost: Host name : localhost IP address: 127.0.0.1 |
| The page was last updated February 19, 2008 |