請問老師,一個類至少有一個默認(rèn)的構(gòu)造函數(shù)吧,這個intetAddress類不存在構(gòu)造函數(shù)的意思是不是因?yàn)椴荒軕{空構(gòu)造一個新的機(jī)器?
請問老師,一個類至少有一個默認(rèn)的構(gòu)造函數(shù)吧,這個intetAddress類不存在構(gòu)造函數(shù)的意思是不是因?yàn)椴荒軕{空構(gòu)造一個新的機(jī)器?
請問老師,一個類至少有一個默認(rèn)的構(gòu)造函數(shù)吧,這個intetAddress類不存在構(gòu)造函數(shù)的意思是不是因?yàn)椴荒軕{空構(gòu)造一個新的機(jī)器?
2016-04-27
舉報
2016-04-28
InetAddress對象的獲取
InetAddress的構(gòu)造函數(shù)不是公開的(public),所以需要通過它提供的靜態(tài)方法來獲取,有以下的方法:
static InetAddress[] getAllByName(String host)
static InetAddress getByAddress(byte[] addr)
static InetAddress getByAddress(String host,byte[] addr)
static InetAddress getByName(String host)
static InetAddress getLocalHost()