今天學完IT十八掌第十七天java基礎課程:
學習內容:
多線程主要應用場景是創建靈活響應的桌面程序。
Socket :
----------------------
1.ServerSocket //偵聽
ServerSocket ss = new ServerSocket(port); //0-1023
Socket socket = ss.accept(); //
服務器
-----------------
1.接收sock
2.接收client的消息.
3.推送消息給所有人。
客戶端
----------------
1.建立連接
2.接收Server的聯繫人列表,更新好友列表
3.寫入數據到服務器.
4.
[192.168.12.34]
\thello world
java設計模式:針對某一問題,專家級的解決方案。
---------------------------------------------
1.單例模式: //單一實例.
[懶漢式]
class Trash{
private static Trash instance ;
public static Trash getInstance(){
if(instance == null){
instance = new Trash();
}
return instance ;
}
private Trash(){
}
}
[餓漢式]
class Trash{
private static Trash instance = new Trahs();
public static Trash getInstance(){
return instance ;
}
private Trash(){
}
}
遇到的問題:
需要幫助的問題