Java 将整数数组传递给使用元素的泛型数组的方法?
我有以下课程Java 将整数数组传递给使用元素的泛型数组的方法?,java,generics,Java,Generics,我有以下课程 public class TestAlgorithm<E extends Comparable<? super E>> { public void testing(E[] array) { for(int i = 0; i<= array.length; i++) { ... // processing code (not important here) }
public class TestAlgorithm<E extends Comparable<? super E>>
{
public void testing(E[] array)
{
for(int i = 0; i<= array.length; i++)
{
... // processing code (not important here)
}
}
}
public class TestAlgorithm您将myAlgo
定义为Integer
类型,但您正在调用int
的向量。使用整数
向量:
Integer[] test = {3,7,8,5,2,1,9,5,4};
我觉得自己像个白痴。谢谢
Integer[] test = {3,7,8,5,2,1,9,5,4};