j通过本地dns解析获得域名的iP
InetAddress[] arr = InetAddress.getAllByName("www.qq.com"); for(InetAddress addr :arr) { if(addr instanceof Inet4Address) { System.out.println("ipv4 : "+addr.getHostAddress()); } else if(addr instanceof Inet6Address){ System.out.println("ipv6 : "+addr.getHostAddress()); } }