“本地主机"与127.0.0.1 Java [英] "localhost" vs 127.0.0.1 java
本文介绍了“本地主机"与127.0.0.1 Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Java为 InetAddress.getByName("localhost").getHostAddress()提供了IP 127.0.0.1. 但是,为什么Java不会为InetAddress.getByName("127.0.0.1").getHostName赋予"localhost".对于以后的版本,我得到"127.0.0.1"作为主机名.请澄清这一点.
Java is giving 127.0.0.1 as IP for InetAddress.getByName("localhost").getHostAddress() But why java not gives "localhost" for InetAddress.getByName("127.0.0.1").getHostName. For later one I get "127.0.0.1" as host name. Please clarify this.
推荐答案
查看全文