本帖最后由 我叫MT 于 2014-2-6 13:48 编辑
- import java.net.*;
- class IPDemo
- {
- public static void main(String[] args) throws UnknownHostException
- {
-
- InetAddress i = InetAddress.getLocalHost();
- int in = InetAddress.hashCode();
- System.out.println(in);
- System.out.println(i.toString());
- System.out.println("Address:"+i.getHostAddress());
- System.out.println("Name:"+i.getHostName());
- }
-
- }
复制代码
|