?? test.java
字號:
package ooad.singleton;
public class Test {
static ConnectionPoolB pool3;
static ConnectionPoolB pool4;
public static void main(String[] args) {
ConnectionPool pool1=ConnectionPool.getPool();
ConnectionPool pool2=ConnectionPool.getPool();
System.out.println(pool1==pool2);
Thread t1=new Thread(){
public void run(){
pool3=ConnectionPoolB.getPool();
}
};
Thread t2=new Thread(){
public void run(){
pool4=ConnectionPoolB.getPool();
}
};
t1.start();
t2.start();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(pool3);
System.out.println(pool4);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -