IP 对应 网址


/* 网址和IP对应的小例子 */
try {
InetAddress address_1 = InetAddress.getByName("www.baidu.com");
InetAddress address_2 = InetAddress.getByName("10.2.8.13");

System.out.println(address_1.toString());
System.out.println(address_2.toString());
} catch (UnknownHostException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}