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);
}
}