日期:2014-05-20  浏览次数:20655 次

【一个泛型问题不懂、路过请帮忙】
错误提示:The type List is not generic; it cannot be parameterized with arguments <Integer>
如图版本是:1.6
ArrayList<BerylliumSphere> sphereList =new ArrayList<BerylliumSphere>(); 没问题


 List<Integer> intList = new ArrayList<Integer>错误
改成
 ArrayList<Integer> intList = new ArrayList<Integer>对了

请问什么情况、帮忙解释下?

------最佳解决方案--------------------
引用:
所以说诡异撒、求解!!!!!!!!!!!!!!

刚还少了一步:
①在项目上按右键,选择build path;
②选择configure build path; 
③remove掉原来的jre1.6;
④点击右边add library按钮;
⑤选择jre system library,然后点next;
⑥选择workspace default jre,然后点finish。
------其他解决方案--------------------
是不是你的包里有个类也叫List?
那你写上全名看看。
java.util.List<Integer> ...
------其他解决方案--------------------
引用:
解决方法可以这样:

楼主的速度真快……手慢了手慢了……
import java.util.*;
这个是不正确的。还是要再加一句:
import java.util.List;
------其他解决方案--------------------

我的这个没有报错啊~
------其他解决方案--------------------
看下List导入的包
------其他解决方案--------------------
代码不是都写了吗
import java.util.*;
import static net.mindview.util.Print.*;这个是我自定义的工具类

------其他解决方案--------------------
引用:
我的这个没有报错啊~



所以说诡异撒、求解!!!!!!!!!!!!!!
------其他解决方案--------------------
引用:
错误提示:The type List is not generic; it cannot be parameterized with arguments <Integer>
如图版本是:1.6
ArrayList<BerylliumSphere> sphereList =new ArrayList<BerylliumSphere>(); 没问题


你所有类上面都存在错误,我估计不是泛型的问题,而是build path出了问题。

①在项目上按右键,选择build path;

②remove掉原来的jre1.6;

③点击右边add library按钮;

④选择jre system library,然后点next;

⑤选择workspace default jre,然后点finish。

应该就没问题了。
------其他解决方案--------------------
引用:
所以说诡异撒、求解!!!!!!!!!!!!!!


楼主这么快就把头像给换了……我写之前一个人都没,楼主的头像还是灰太狼……

写完之后,楼主的头像就变“可爱小女孩”了……灰太狼变小女孩,大叔莫卖萌……
------其他解决方案--------------------
引用:
引用:错误提示:The type List is not generic; it cannot be parameterized with arguments <Integer>
如图版本是:1.6
ArrayList<BerylliumSphere> sphereList =new ArrayList<BerylliumSpher……

嗯、代码是没问题;你说的之前我也做过 没效果


解决方法可以这样:


好麻烦啊!!

------其他解决方案--------------------
引用:
引用:所以说诡异撒、求解!!!!!!!!!!!!!!

楼主这么快就把头像给换了……我写之前一个人都没,楼主的头像还是灰太狼……