标签:java
package test; import java.io.IOException; import java.net.InetAddress; public class Test { public static void main(String[] args) throws IOException { String url="www.baidu.com";//不知为什么加上http://报错 InetAddress address=InetAddress.getByName(url); System.out.println("baidu的IP地址:" + address.getHostAddress()) ; } /** *baidu的IP地址:119.75.217.109 */ }
标签:java
原文地址:http://blog.csdn.net/ztt_1119/article/details/46626189