日期:2014-05-20 浏览次数:20753 次
package generics; public class Exercise22<T> { T x; Exercise22(Class<T> args) { try { x=args.newInstance(); }catch(Exception e) { System.out.print("error"); } } public static void main(String[] args) { Exercise22 e= new Exercise22(Integer.class); System.out.print(e.x); } }