Consider the following code

```
/**
 * Generic method with bounds
 */
public static <T> int countGreaterThan(Comparable<T>[] anArray,
        T elem) {
    int count = 0;
    for (Comparable<T> e : anArray)
        if (e.compareTo(elem) > 0)
            ++count;
    return count;
}
/**
 * Alternative to above
 */
public static <T extends Comparable<T>> int countGreaterThan(T[] anArray, T elem) {
    int count = 0;
    for (T e : anArray)
        if (e.compareTo(elem) > 0)
            ++count;
    return count;
}

```

It appears that both are functionally the same. However they can appear in the same class apparently overloading each other. When I use the following code, it seems the second method gets invoked. Without the second overloading method, the first method get invoked. Can someone provide an in-depth explanation?

```
    Integer[] array = new Integer[10];
    for (int i = 0; i < array.length; ++i)
        array[i] = i;

    System.out.println("Count > 5 = " + countGreaterThan(array, 5));

```