以下实例演示了如何使用 InetAddress 类的 InetAddress.getByName() 方法来获取指定主机(网址)的IP地址:
Main.java 文件
以上代码运行输出结果为:
www.runoob.com=222.73.134.120