- package test;
- import java.lang.reflect.Constructor;
- import java.lang.reflect.Field;
- import java.lang.reflect.InvocationTargetException;
- import java.lang.reflect.Method;
- public class Demo1 {
- /**
- * @param args
- * @throws IllegalAccessException
- * @throws InstantiationException
- * @throws SecurityException
- * @throws NoSuchMethodException
- * @throws InvocationTargetException
- * @throws IllegalArgumentException
- */
- public static void main(String[] args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
- // TODO Auto-generated method stub
-
-
- System.out.println(int[].class.getName());
- for(Field field:int[].class.getFields()){
-
- System.out.println(field.getName());
- }
- for(Method method:int[].class.getMethods()){
-
- System.out.println(method.getName());
- }
- for(Constructor constructor:int[].class.getConstructors()){
-
- System.out.println(constructor.getName());
- }
- }
- }
复制代码 |