错误提示: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>对了请问什么情况、帮忙解释下?
如图版本是:1.6
ArrayList<BerylliumSphere> sphereList =new ArrayList<BerylliumSphere>(); 没问题
List<Integer> intList = new ArrayList<Integer>错误
改成
ArrayList<Integer> intList = new ArrayList<Integer>对了请问什么情况、帮忙解释下?
import java.util.*;
import static net.mindview.util.Print.*;这个是我自定义的工具类
你所有类上面都存在错误,我估计不是泛型的问题,而是build path出了问题。①在项目上按右键,选择build path;②remove掉原来的jre1.6;③点击右边add library按钮;④选择jre system library,然后点next;⑤选择workspace default jre,然后点finish。应该就没问题了。
那你写上全名看看。
java.util.List<Integer> ...
①在项目上按右键,选择build path;
②选择configure build path;
③remove掉原来的jre1.6;
④点击右边add library按钮;
⑤选择jre system library,然后点next;
⑥选择workspace default jre,然后点finish。
import java.util.*;
这个是不正确的。还是要再加一句:
import java.util.List;
编译环境不知道到底用java.util.List,还是用楼主提供的包。要是存在同名的包,发生冲突,得用类的全路径,也就是在程序里使用java.util.List<Integer>