title: cast Object to Comparable in java
body: <p>Here we have generic method:</p>
  
  <pre><code>public static &lt;T extends Comparable&lt;T&gt;&gt; T[] function(T[] a)
  {
      Object[] m = new Object[2];
  
      /* some work here */
  
      return (T[]) m;
  }
  </code></pre>
  
  <p>A <code>ClassCastException</code> is thrown . What's wrong with it?</p>