課程
/后端開發
/Java
/Java Socket應用---通信是這樣練成的
請問老師,一個類至少有一個默認的構造函數吧,這個intetAddress類不存在構造函數的意思是不是因為不能憑空構造一個新的機器?
2016-04-27
源自:Java Socket應用---通信是這樣練成的 2-1
正在回答
InetAddress對象的獲取InetAddress的構造函數不是公開的(public),所以需要通過它提供的靜態方法來獲取,有以下的方法: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()
meersun 提問者
丶子非魚
舉報
分享的是 Java 中的網絡編程,使用Socket實現網絡聊天通信
4 回答為什么調用類的構造函數 會調用類里面的方法?
1 回答為什么老是說InetAddress沒有構造方法
1 回答使用printwriter的含自動刷新緩沖區的構造方法時,沒有產生輸出,為什么
2 回答老師想請教一個問題,關于數據庫存儲圖片的方式
1 回答請教老師一個問題
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-04-28
InetAddress對象的獲取
InetAddress的構造函數不是公開的(public),所以需要通過它提供的靜態方法來獲取,有以下的方法:
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()