您的位置:程序门 -> java -> j2se / 基础类



请问个泛型通配符问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


请问个泛型通配符问题
发表于:2008-01-14 20:23:21 楼主
在一个项目中,我希望用list泛型通配符来add数据,不过出错了。请那位大虾给小弟说说这个list的通配符可不可这样做。谢谢。。。
public   class   test   {
private   static   list <?   extends   object>   list;
public   static   void   main(string[]   args)   {
list   =   new   arraylist <string> ();
list.add("aaa");
list.get(1);
}
}
提示如下
severity   and   description path resource location creation   time id
the   method   add(capture#2-of   ?)   in   the   type   list <capture#2-of   ?>   is   not   applicable   for   the   arguments   (string) test.java line   10 1200313007390 6736


快速检索

最新资讯
热门点击