title: Creating an instance of an array of objects class in Java
body: <p>I'm new to Java, and I'm getting an error in my main function when I try to create an instance of a DeckofCards class.  The DeckofCards class is supposed to be a private array of "Cards" objects.  I think my issue is something in the DeckofCards class, for some reason it's not an array I think? Maybe I created it wrong? </p>
  
  <p>The errors in my main are 
  <strong>'(' or '[' expected</strong>
  and
  <strong>array required but DeckofCards found</strong></p>
  
  <p>Here is my main function:</p>
  
  <pre><code>public static void main(String[] args) {
  
          Card myCard = new Card(13,1);
          System.out.println(myCard.getSuit());
          System.out.println(myCard);
          DeckofCards myDeck = new DeckofCards;  //error here
          for(int i=0; i&lt;53; i++) {
              System.out.println(myDeck[i]); //second error here
          }
      }
  </code></pre>
  
  <p>Here is my DeckofCards class:</p>
  
  <pre><code>public class DeckofCards {
  
      private Card[] deck = new Card[52];
  
      public DeckofCards(){
          int i = 0;
  
              for(int s = 1; s&lt;5; s++){
                  for(int r = 1; r&lt;14; r++){
              deck[i].rank = r;
              deck[i].suit = s;
              i++;
  
      }
  }
      }
  }
  </code></pre>
  
  <p>If anyone can tell me if I'm missing some syntax or something that'd be great!  Thank you.</p>