摘要: public static void main(String[] args) { Dd d = new Dd(); List<String> l1 = new ArrayList<String>(); d.test(l1); List<Integer> l2 = new ArrayList<Inte 阅读全文
posted @ 2022-03-12 16:26 SmallPepsi 阅读(30) 评论(0) 推荐(0)
摘要: public static void main(String[] args) { B1<Object> b1 = new B1<Object>(); System.out.println(b1.test(1)); B2 b2 = new B2(); System.out.println(b2.tes 阅读全文
posted @ 2022-03-12 16:10 SmallPepsi 阅读(164) 评论(0) 推荐(0)
摘要: public class 泛型方法 { public static void main(String[] args) { Cc<Object> c = new Cc<Object>(); System.out.println(c.test1("你好"));//String //泛型方法在调用前,没有 阅读全文
posted @ 2022-03-12 16:03 SmallPepsi 阅读(1573) 评论(0) 推荐(0)
摘要: public class 泛型类 { public static void main(String[] args) { A<String> a1 = new A<String>();//在new A的对象指定泛型的类型 类型是String a1.setKey("xxxx");//对象使用setKey 阅读全文
posted @ 2022-03-12 16:01 SmallPepsi 阅读(43) 评论(0) 推荐(0)