public class IllegalAccessExcept { public static void main(String[] args) throws IllegalAccessException, InstantiationException { Class<?> classVar = ExampleClass.class; ExampleClass t = (ExampleClass) classVar.newInstance(); t.testMethod(); } } class ExampleClass { private ExampleClass(){ } public void testMethod(){ System.out.println("Method 'testMethod' Called"); } }
No comments:
Post a Comment