import java.net.*;
class InetAddressDemo {
static String host = "localhost";
public static void main(String[] args) throws UnknownHostException {
if (args.length == 1)
host = args[0]; InetAddress ia = InetAddress.getByName(host); System.out.println(
"Canonical Host Name = "
+ ia.getCanonicalHostName());
System.out.println(
"Host Address = " + ia.getHostAddress());
System.out.println(
"Host Name = " +ia.getHostName());
System.out.println(
"Is Loopback Address = " + ia.isLoopbackAddress());
}
}
class InetAddressDemo {
static String host = "localhost";
public static void main(String[] args) throws UnknownHostException {
if (args.length == 1)
host = args[0]; InetAddress ia = InetAddress.getByName(host); System.out.println(
"Canonical Host Name = "
+ ia.getCanonicalHostName());
System.out.println(
"Host Address = " + ia.getHostAddress());
System.out.println(
"Host Name = " +ia.getHostName());
System.out.println(
"Is Loopback Address = " + ia.isLoopbackAddress());
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货