InetAddress[] addr = InetAddress.getAllByName(name);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
InetAddress.getAllByName()的返回类型是InetAddress
而你的等式左边是个InetAddress数组类型
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
InetAddress.getAllByName()的返回类型是InetAddress
而你的等式左边是个InetAddress数组类型
throws UnknownHostExceptionReturns:
an array of all the IP addresses for a given host name.
还是addr[i].getHostAddress()???