public class Reflection {
public static void runReflection(String packageName, String className) {
try {
Class<?> c = Class.forName(className);
Point p=(Point)c.newInstance();
p.dynamicExecute();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
public static void main(String args[]){
Reflection r =new Reflection();
r.runReflection("Reflection", "Point");
}
}
public static void runReflection(String packageName, String className) {
try {
Class<?> c = Class.forName(className);
Point p=(Point)c.newInstance();
p.dynamicExecute();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
public static void main(String args[]){
Reflection r =new Reflection();
r.runReflection("Reflection", "Point");
}
}
No comments:
Post a Comment