cannot be cast to [Ljava.lang.Comparable
<p>So I need to do dynamic ordered list.</p>

<pre><code>    public class DynArrayListOrd&lt;T extends Comparable&lt;T&gt;&gt;  {
        private T[] tab ;

        public DynArrayListOrd()
        {
          tab = (T[])new Object[startSize];
        }
        ....

        main {
          DynArrayListOrd tab = new DynArrayListOrd();

          tab.add("John");
          tab.add("Steve");
        }
</code></pre>

<p>And when I run the code I get error:</p>

<pre><code>Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Comparable;
    at structures.DynArrayListOrd.&lt;init&gt;(DynArrayListOrd.java:14)
    at structures.DynamicArrayAppp.main(DynArrayListOrd.java:119)
</code></pre>