import java.net.InetAddress;
import java.net.UnknownHostException;
 
public class MainProcess {
    public static void main(String[] args) {
        InetAddress localhost = null;
        try {
            localhost = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        System.out.println ("localhost: "+localhost.getHostAddress());
        System.out.println ("localhost: "+localhost.getHostName());
    }
}

 

相关文章:

  • 2021-10-20
  • 2022-02-06
  • 2021-10-01
  • 2021-10-08
  • 2022-02-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
  • 2022-12-23
  • 2021-12-15
  • 2022-01-26
相关资源
相似解决方案