?? testb.java
字號:
package ch10.section02;
public class TestB {
public static void main(String[] args) {
SingletonB instance1 = SingletonB.GetInstance("Sub1");
if (instance1 == null) {
System.out.println("There is no such instance in registry !");
}
else {
System.out.println(instance1.getClass());
}
try {
SingletonB instance2 = new SubSingletonB();
System.out.println("We had created a new instance named \"Sub1\" now");
}
catch (SingletonException e) {
System.out.println(e.getMessage());
}
instance1 = SingletonB.GetInstance("Sub1");
if (instance1 == null) {
System.out.println("There is no such instance in registry !");
}
else {
System.out.println(instance1.getClass());
}
try {
SingletonB instance3 = new SubSingletonB();
System.out.println("We had created a new instance named \"Sub1\" now");
}
catch (SingletonException e) {
System.out.println(e.getMessage());
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -