Java通过域名获得服务器的IP地址
import java.net.InetAddress;public class InetAddressClass {public static void main(String[] args) throws Exception {new InetAddressClass().test();}public void test() throws Exception{InetAddress ia = InetAddress.getByName ("www.sina.com");String value1=ia.getCanonicalHostName();String value2=ia.getAddress().toString();String value3=ia.getHostAddress().toString();String value4=ia.getHostName().toString();String value5=ia.getByName("www.sina.com").toString();System.out.println(value5);}}