Java 编程交流贴
大神求解,下面的Java程序在myeclipse中运行输出IP地址什么原因import *;
public class ghj {
public static void main(String[] args) {
InetAddress ip=null;
try{
ip =InetAddress.getLocalHost();
String localname= ip.getHostName();
String localip= ip.getHostAddress();
System.out.println("本机名:"+localname);
System.out.println("本机ip地址:"+localip);
}catch(UnknownHostException e){
e.printStackTrace();
}
}
}