摘要:
public class GenericTest6 { @Test public void test01() { Object obj = null; String str = null; obj = str; Integer[] arr = null; Object[] arr2 = null; 阅读全文
摘要:
public class Student<T> { private T studentT; //静态方法中不能使用泛型 // public static void show(T studentT) { // System.out.println(studentT); // } public void 阅读全文
摘要:
泛型方法:在方法中出现了泛型的结构,泛型参数与类的泛型参数没有任何关系,也就是说,泛型方法所属的类是不是泛型类都没有关系 //泛型方法:在方法中出现了泛型的结构,泛型参数与类的泛型参数没有任何关系 //也就是说,泛型方法所属的类是不是泛型类都没有关系 //下述方法才为泛型方法,注意格式 public 阅读全文
摘要:
1. 静态方法中不能使用泛型 2. 泛型数组的正确写法 public class Student<T> { private T studentT; //静态方法中不能使用泛型 // public static void show(T studentT) { // System.out.println 阅读全文