CODE
public class MyArray <T extends Comparable<? super T>>
{
private T[] arr;
public MyArray(T[] a)
{
arr = Arrays.copyOf(a, a.length);
}
public T max()
{
//int size = arr.length;
T maximum = arr[0];
for(int i=1;i<arr.length;i++)
{
if(arr[i].compareTo(maximum)>0)
maximum=arr[i];
}
return maximum;
}
}
CODE
public class Main {
public static void main(String[] args) {
Integer[] intArr ={new Integer(20), new Integer(30), new Integer(10), new
Integer(80), new Integer(70), new Integer(100)};
MyArray<Integer> myInt = new MyArray<Integer>(intArr);
System.out.println("Tnteger array:");
for(int i=0;i<intArr.length;i++)
{
System.out.print(intArr[i]+" ");
}
System.out.println("Max:"+ myInt.max());
}
}
here is my problem:
MyArray<Integer> myInt = new MyArray<Integer>(intArr)
it said that the parameter is not within its bound
can anyone help me what is about....