title: Iterating through ArrayList of Objects in Java
body: <p>I have tried to find an answer to my question here but with no luck - please let me know if this was already answered and I will delete this question.</p>
  <p>I want to iterate through an ArrayList of playing cards, here is my code:</p>
  <pre><code>public static void showCards(ArrayList&lt;Card&gt; cards){
      Iterator iterator = cards.iterator();
      while(iterator.hasNext()){
          String object = String.valueOf(iterator.next());
          System.out.println(object);
      }
  }
  </code></pre>
  <p>I want to print the value of each card, but I am only getting the reference:</p>
  <pre><code>com.company.Card@4517d9a3
  com.company.Card@4517d9a3
  </code></pre>
  <p>I have tried looping through as well - same thing. What am I doing wrong?</p>
  <p>Card class if needed:</p>
  <pre><code>public class Card {
  private CardSuit cardSuit;
  private CardValue cardValue;
  
  public Card(CardSuit cardSuit,  CardValue cardValue) {
      this.cardValue = cardValue;
      this.cardSuit = cardSuit;
  }
  
  public CardValue getCardValue() {
      return cardValue;
  }
  
  public CardSuit getCardSuit() {
      return cardSuit;
  }
  
  }
  </code></pre>