I'm getting an error
-The method compareTo(Object) is undefined for the type Object- with this code:
public static Object getMinimum (Object[] array)
{
Object min = array[0];
for (int i = 1; i < array.length; i++) {
if (min.compareTo(array) > 0) {
min = array[i];
}
}
return min;
}
The objects in the array will always implement the Cloneable interface, but they can't use it, as they are treated as Object instances, not as instances of their own class. How can I fix this without using a Comparator?
Thanks in advance