the*_*ner 116
看看InetAddress和getHostAddress()方法.
InetAddress address = InetAddress.getByName("www.example.com");
System.out.println(address.getHostAddress());
Run Code Online (Sandbox Code Playgroud)
Wal*_*uch 27
你可以这样做:
for(InetAddress addr : InetAddress.getAllByName("stackoverflow.com"))
System.out.println(addr.getHostAddress());
Run Code Online (Sandbox Code Playgroud)
您可以使用InetAddress.试试下面的代码,
InetAddress address = InetAddress.getByName("www.yahoo.com");
System.out.println(address.getHostAddress());
System.out.println(address.getHostName());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
89186 次 |
| 最近记录: |