InetAddress[] addr = InetAddress.getAllByName(name);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
InetAddress.getAllByName()的返回类型是InetAddress
而你的等式左边是个InetAddress数组类型

解决方案 »

  1.   

    public static InetAddress[] getAllByName(String host)
                                      throws UnknownHostExceptionReturns:
    an array of all the IP addresses for a given host name. 
      

  2.   

    addr.getHostAddress()
    还是addr[i].getHostAddress()???