public static void main(String[] args) {
String name = Entiers.class.getName();
Class cl = null;
- Object o = null;
+ Entiers o = null;
try {
cl = Class.forName(name);
- Class[] types = new Class[]{Integer.class};
- Constructor ct = cl.getConstructor(types);
- o = ct.newInstance(new Integer(100));
+ o = new Entiers(100);
}
catch (ClassNotFoundException e) {
System.out.println("Class name do not exist.");
System.exit(-1);
}
- catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- catch (InstantiationException e) {
- e.printStackTrace();
- }
- catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- catch (InvocationTargetException e) {
- e.printStackTrace();
- }
Scanner uInput = null;
try {