获得本机IP地址,本机名

取得本机IP地址,本机名System.out.println(Host Ip Address: + InetAddress.getLocalHost())System.ou

取得本机IP地址,本机名
System.out.println("Host Ip Address: " + InetAddress.getLocalHost());
System.out.println("Local Host: " + InetAddress.getLocalHost());
}catch(UnknownHostException e){
System.out.println(e.toString());
}

?输出结果:

?

Host name: localhost
Host Ip Address: lxw/172.19.7.119
Local Host: lxw/172.19.7.119