title: convert object into date
body: <p>I get an <code>ArrayList</code> of <code>Object[]</code> from a database and I want to convert the <code>java.sql.Date</code> stored in an object into a <code>java.util.Date</code> (in order to use it in jfreechart):
  my code is as follows:</p>
  
  <p>fills up the Array of object with data from MySQL</p>
  
  <pre><code> ArrayList&lt;Object[]&gt; mydata=new ArrayList&lt;&gt;(); 
   mydata=sqlGetter.getMdbObjectList(sqlString, null);
  
  
  for(Object[] myobject : mydata){
          if (myobject[1].getClass()==java.sql.Date.class){
             java.util.Date mydate=null;
             mydate = Date ( myobject[1]);  
          } 
  }
  </code></pre>
  
  <p>Netbeans return an error: "Java incompatible types: Object cannot be converted to Date"</p>
  
  <p>While I understand the idea, I would have expected to be able to cast the object into a Date after having checked that it is indeed of the right class.</p>
  
  <p>I'm starting java, so please any helps on the obvious mistake that I must be doing would be useful.</p>