Cannot find compareTo when receiving comparable Object[]
<p>The problem is the method is not sure a and b are comparable so the compiler throws a cannot find symbol for compareTo.</p>

<pre><code>public class Merge {
    public ArrayList&lt;Object&gt; sorted(Object[] a, Object[] b) {

        int i, j, k;
        i = j = k = 0;
        ArrayList&lt;Object&gt; c = new ArrayList&lt;&gt;();
        while (i &lt; a.length || j &lt; b.length) {
            if (i == a.length) {
                for (j = j; j &lt; b.length; j++) {
                    c.add(k, b[j]);
                    k++;
                }
                break;
            }
            else if (j == b.length) {
                for (i = i; i &lt; a.length; i++) {
                    c.add(k, a[i]);
                    k++;
                }
                break;
            }
            else {
                if ( a[i].equals(b[j]) || a[i].compareTo(b[j]) &lt; 0 ) {
                    c.add(k, a[i]);
                    i++;
                    k++;
                }
                else {
                    c.add(k, b[j]);
                    j++;
                    k++;
                }
            }
        }
        return c;
    }
}
</code></pre>

<p>The code works when used with Integer. I want to be able to use for example, <code>sorted(a, b)</code> being <code>a = Person[]</code> and <code>b = Person[]</code>. Of course with methods compareTo and equals inside Person.</p>

<p>Should I implement and extend comparable with an ObjectType inside this class and override compareTo?</p>