设计模式

This commit is contained in:
luoxiang
2019-12-02 23:22:03 +08:00
parent 6858a78396
commit e28071e796
4 changed files with 238 additions and 21 deletions

View File

@ -10,6 +10,7 @@ public class ReflectionDamage {
Constructor<HungrySingleton> constructor = HungrySingleton.class.getDeclaredConstructor();
constructor.setAccessible(true);
HungrySingleton hungrySingleton = constructor.newInstance();
System.out.println(hungrySingleton);
HungrySingleton instance = HungrySingleton.getInstance();
System.out.println(hungrySingleton == instance);
}
}