总结::不懂。。。
package com.aa;
import java.net.*;
public class InetAddresTest {
public static void main(String[] args) throws UnknownHostException {
InetAddress ia;
ia = InetAddress.getByName("www.baidu.com");
System.out.println("百度网的ip是" + ia.getHostAddress());
ia = InetAddress.getByName("www.qq.com");
System.out.println("腾讯的主机地址是:" + ia.getHostAddress());
ia = InetAddress.getLocalHost();// localhost.指的是本机
System.out.println("本机ip是:" + ia.getHostAddress());
}
}
百度网的ip是115.239.210.27
腾讯的主机地址是:101.226.129.158
本机ip是:27.18.219.15