动态加载自各儿

动态加载自己
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Class clazz = Class.forName("com.swimap.lmt.po.Dept");
Object entity = clazz.newInstance();
Method method = clazz.getMethod("setDeptid", int.class);
Method method1 = clazz.getMethod("getDeptid", null);
method.invoke(entity, 110);
Object obj =method1.invoke(entity, null);
System.out.println(obj);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}