-1
public class t<T extends Number>{
private ArrayList<T> a = new ArrayList<T>();
public void add(T x){
a.add(x);
}
public T largest(){
T large = a.get(0);
int count = 1;
while(a.get(count)!=null){
if(a.get(count)>large)
large = a.get(count);
count++;
}
return large;
}
public T smallest(){
T small = a.get(0);
int count = 1;
while(a.get(count)!=null){
if(a.get(count)<small)
small = a.get(count);
count++;
}
return small;
}
}为什么我在我的方法中出现错误“二元运算符的错误操作数类型”?
我收到错误在我如果陈述我的最大和最小方法中。我在排除错误方面没有运气。请帮忙。非常感谢你。