12 2012 档案
摘要:来源:http://www.cnblogs.com/whgw/archive/2011/10/05/2199535.htmlJava中单利模式有三种: 懒汉式、饿汉式、登记试饿汉式:public class Singleton { private Singleton() {} private static Singleton instance = new Singleton(); public static Singleton getInstance() { return instance; }}懒汉式:public class Singleton { ...
阅读全文
摘要:原帖在:http://www.coo8ger.com/?p=141服务器端代码:import java.io.*;import java.net.*;public class MyServer { public static void main(String[] args) throws IOException { ServerSocket server = new ServerSocket(5678); Socket client = server.accept(); BufferedReader in = new BufferedReader...
阅读全文