解决方案 »

  1.   

    import java.lang.reflect.Constructor;
    import java.lang.reflect.InvocationTargetException;public class ConstrctorRef  { public static void main(String[] args) throws SecurityException,
    NoSuchMethodException, IllegalArgumentException, InstantiationException,
    IllegalAccessException, InvocationTargetException { String s1 = new String(new StringBuffer("cjgong")); Constructor cs1 = String.class.getConstructor(StringBuffer.class); String s11 = (String) cs1.newInstance(new StringBuffer("cjgong"));
    System.out.print("-------");
    System.out.print("s1对象的第5个元素为" + s1.charAt(4));
    System.out.print("s11对象的第5个元素为" + s11.charAt(4));
    System.out.print("-------");
    }}