title: Finding Total of ArrayList Objects Java
body: <p>I need to find the total of some ArrayList objects (playing card values). I have a Card.java class and a User.java class. I have a userHand ArrayList also. I'm not getting any errors but it's not printing the sum. Here is my code:</p>
  
  <p><strong>Card.java</strong></p>
  
  <pre><code>import java.util.Random;
  
  
  public class Card {
  
  //Variables
  public static String[] card_types = { "spades", "hearts", "clubs", "diamonds"};
  public static int value;
  public static String type;
  
  Card(){
      value = genCardValue();
      type = genCardType();
  }
  
  //Get the value of the card
  public static int getValue(){
      return value;
  }
  
  //Get the type of the card
  public static String getType(){
      return type;
  }
  
  //Generate the card value (example: 5)
  public static int genCardValue(){
  
      int min = 2;
      int max = 11;
      int range = max - min;
  
      int cardValue = new Random().nextInt(range + 1) + 2;
  
      return cardValue;
  }
  
  
  //Generate the card type (example: spades)
  public static String genCardType(){
      String cardType = (card_types[new Random().nextInt(card_types.length)]);
  
      return cardType;
  }
  
  
  }
  </code></pre>
  
  <p><strong>User.java</strong></p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  
  public class User {
  
  List&lt;Card&gt; userHand = new ArrayList&lt;Card&gt;();
  int i = 10;
  
  User(){
      userHand.add(0, new Card());
      userHand.add(1, new Card());
      int sum = 0;
  
      for (Card card : userHand){
          int cardValue = card.getValue();
          sum += cardValue;
      }
  
      System.out.println(sum);
  }
  
  
  }
  </code></pre>
  
  <p>It is just printing blank. Any help is appreciated! Thanks!</p>