title: how to deal with this ArraystoreException element type mismatch?
body: <p>I have a problem with this code:</p>
  
  <pre><code>package com.josuecode.tournament;
  import java.util.*;
  public class test {
  
      public static void main(String[] args) {
  
          ArrayList &lt;Chessplayers&gt; registers = new ArrayList &lt;Chessplayers&gt; ();
  
          Lists_methods.registrartion(registers,(short) 1);
          Chessplayers[][] round1 = new Chessplayers [2][(int) Math.ceil(registers.size() / 2)];
          round1 = registers.toArray(round1);
  
          for (int i = 0; i &lt; round1.length; i++) {
              System.out.println(round1[i]);
          }
      }
  }
  </code></pre>
  
  <p>I got this exception in the line 11</p>
  
  <p>"Exception in thread "main" java.lang.ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object[] to the type of the destination array, [Lcom.josuecode.tournament.Chessplayers;"</p>
  
  <p>and I don't know why if both (the ArrayList and the Array) are of the same type.</p>
  
  <p>in the ArrayList are stored Chessplayers class objects and I want to convert that List into java Array.</p>