title: Incompatible types error when iterating through enum elements to create new object
body: <p>I am trying to use two enums to create a deck of cards via a 2d array, then print all of the created cards.</p>
  
  <pre><code>public class Deck {
  
  private Card[][] cards;
  
  public Deck() {
    cards = new Card[4][13];
    for (Card.Suit suit : Card.Suit.values()) {
       for (Card.Rank rank : Card.Rank.values()) {
          //This is where my problem begins
          cards[suit][rank] = new Card(suit, rank);
       }
    }
  }
  
  
  
  public Card getCard(Card.Suit s, Card.Rank r) {
     //The error appears here as well.
     return cards[suit][rank];
  }
  </code></pre>
  
  <p>Here are the enums I'm trying to use.</p>
  
  <pre><code>public class Card {
     private Rank rank;
     private Suit suit;
  
     // Kinds of suits
     public enum Suit {
        CLUBS,
        DIAMONDS,
        HEARTS,
        SPADES;
     }
  
     // Kinds of ranks
     public enum Rank {
        ACE,
        DEUCE,
        THREE,
        FOUR,
        FIVE,
        SIX,
        SEVEN,
        EIGHT,
        NINE,
        TEN,
        JACK,
        QUEEN,
        KING;
     }
  
     public Card(Suit s, Rank r) {
        rank = r;
        suit = s;
     }
  ...}
  </code></pre>
  
  <p>What I think should be happening is that the for loop is going through each element via Card.Suit.values() and then Card.Rank.values() and creating a new Card(Suit suit, Rank rank), according to it's index in the array cards[s][r].</p>
  
  <p>When I compile my code it gives the error.</p>
  
  <p>"Deck.java:42: error: incompatible types: Suit cannot be converted to int</p>
  
  <p>cards[suit][rank] = new Card(suit, rank);"</p>