title: How to cast field to specific class using reflection in java?
body: <p>I am using reflection to put all my class's member variables that are of type <code>Card</code> class into an <code>ArrayList&lt;Card&gt;</code> instance. How do I finish this last part (see commented line below)?         </p>
  
  <pre><code>ArrayList&lt;Card&gt; cardList = new ArrayList&lt;Card&gt;();
  Field[] fields = this.getClass().getDeclaredFields();
  
  for (Field field : fields) {
     if (field.getType() == Card.class) {
        //how do I convert 'field' to a 'Card' object and add it to the 'cardList' here?
  </code></pre>