import java.net.*;
public class MyInetAddress1{
public static void main(String[] args) throws Exception{
//getLocalHost()
InetAddress localAddress= InetAddress.getLocalHost();
String local= localAddress.toString();
String temp[]= local.split("/");
System.out.println("getLocalHost()");
System.out.println("主æºå: "+temp[0]);
System.out.println("IPå°åï¼"+temp[1]);
//System.out.println(localAddress);
}
}
温馨提示:答案为网友推荐,仅供参考