摘要:
class Single { private static Single s = new Single(); private Single(){}; public static Single getInstance() { return s; } } 延迟加载 class Single { priv 阅读全文
摘要:
1.创建方式 1. 声明Thread的子类,重写Thread类中的run()方法。通过调用线程.start()方法启动线程 class ThreadDemo extends Thread { public void run() { synchronized(obj) { } //同步代码块 } } 阅读全文