Is this statement correct in java?
问题 I would like to do a data transfer between two computers using datagram socket.Iam using the following line this way : host=InetAddress.getByAddress("mypc",new byte[]{192,168,1,110}); but when i use the above statement i get this error :"Possible loss of precision" So i cast the int to bytes this way : InetAddress.getByAddress("mypc",new byte[]{(byte)192,(byte)168,(byte)1,(byte)110}); Would the above statement work now ??? 回答1: If you already have it in a string, just use getByName() :