- import java.lang.reflect.Constructor;
- import java.util.*;
- public class ReflectTest
- {
- public static void main(String[] args) throws Exception
- {
- Constructor constructor=List.class.getConstructor(int.class);
- List list=(List)constructor.newInstance(1);
- System.out.println(list);
- }
- }
复制代码 |
|