package demo;
import java.net.InetAddress;
public class LocalHostAddressName {
public static void main(String[] args) throws Exception{
InetAddress inetAddr = InetAddress.getLocalHost();
String hostAddress = InetAddress.getLocalHost().getHostAddress();
String hostName = inetAddr.getHostName();
System.out.println(hostAddress);
System.out.println(hostName);
}
}
Get HostName And HostAddress
最新推荐文章于 2023-01-02 13:27:53 发布