java.lang.Object
  java.net.InetAddress
代码??
自己应该不成问题把

解决方案 »

  1.   

    InetAddress add = InetAddress.getLocalHost();
    String hostname = add.getHostName();
    String ip = add.getHostAddress();
      

  2.   

    楼上的官人们不厚道!=================================================================================
    import java.net.*;class address{ public static void main(String[] args) throws UnknownHostException {
    InetAddress Address = InetAddress.getLocalHost();
    System.out.println("local ip:"+Address.getHostAddress());
    System.out.println("local name:"+Address.getHostName());
    Address = InetAddress.getByName("www.sohu.com");
    System.out.println("remote ip:"+Address.getHostAddress());
    System.out.println("remote name:"+Address.getHostName());
    }
    }====================================================================================
      

  3.   

    这个是客户端的ip地址吗,还是只能获得server的ip地址?奴家不明白呀