Пример #1
0
 public static void main(String[] args) {
   Class c = null;
   try {
     c = Class.forName("Test.FancyToy");
   } catch (ClassNotFoundException e) {
     print("Can't find FancyToy");
     System.exit(1);
   }
   printInfo(c);
   for (Class face : c.getInterfaces()) printInfo(face);
   Class up = c.getSuperclass();
   Object obj = null;
   try {
     obj = up.newInstance();
   } catch (InstantiationException e) {
     print("Cannot instantiate");
     System.exit(1);
   } catch (IllegalAccessException e) {
     print("Cannot access");
     System.exit(1);
   }
   printInfo(obj.getClass());
 }