1、InetAddress
InetAddress is = InetAddress.getLocalHost (); // Get the local object through static methods
System.out.println(is.getHostAddress()); // Get IP address
System.out.println(is.getHostName()); // Get the domain name
is = InetAddress.getByName("www.qq.com"); // Create object by domain name
is = InetAddress.getByName("59.37.96.63"); // create object by IP address