类新实例
/* 时代Java公众号 - N o w J a v a . c o m */ //package com.nowjava; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Map; public class Main { public static void main(String[] argv) throws Exception { Class theClass = String.class; System.out.println(newInstance(theClass)); } private static Map primitiveClassWrapperMap; public static Object newInstance(Class theClass) throws InstantiationException, IllegalAccessException {/*时 代 Java - nowjava.com*/ if (null != primitiveClassWrapperMap.get(theClass)) { theClass = (Class) primitiveClassWrapperMap.get(theClass); } return theClass.newInstance(); } public static Object newInstance(Class theClass, String param) throws InstantiationException, IllegalAccessException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException { if (null != primitiveClassWrapperMap.get(theClass)) { theClass = (Class) primitiveClassWrapperMap.get(theClas