@Test public void testReflection() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException, ClassNotFoundException { SingletonHungryMan sone = SingletonHungryMan.INSTANCE; Object stwo = createAnotherInstanceUsingRelection(); sone.sayHello(); invokeMethod(stwo, "sayHello"); }
public void sayHello() { System.out.println("hello"); }
SingletonHungryMan { public void sayHello() { System.out.println("hello"); } }
SingletonHungryMan { public void sayHello() { System.out.println("hello"); } private  SingletonHungryMan(); }
SingletonHungryMan { public void sayHello() { System.out.println("hello"); } private  SingletonHungryMan(); void sayHello(); }
SingletonHungryMan { public void sayHello() { System.out.println("hello"); } private  SingletonHungryMan(); void sayHello(); final static SingletonHungryMan INSTANCE; }