When I try to compile a small program I wrote that builds an array of a deck of cards and prints them, I get 6 errors all of which are "cannot find symbol" errors. Can somebody check my code and find the mistakes please? Thanks.
Compile Output:
sudhakar@sudhakar-Dell-DXP061 ~/deck $ javac doDeck.java Deck.java Card.java
doDeck.java:7: cannot find symbol
symbol : variable deck
location: class carddeck.Deck
System.out.println(mydeck.deck[x].getRankString() + " of " + mydeck.deck[x].getSuitString());
^
doDeck.java:7: cannot find symbol
symbol : variable deck
location: class carddeck.Deck
System.out.println(mydeck.deck[x].getRankString() + " of " + mydeck.deck[x].getSuitString());
^
Deck.java:4: cannot find symbol
symbol : variable deck
location: class carddeck.Deck
deck = new Card[51];
^
Deck.java:10: cannot find symbol
symbol : variable deck
location: class carddeck.Deck
this.deck[cardcount] = new Card(suitit,rankit);
^
Deck.java:10: cannot find symbol
symbol : variable cardcount
location: class carddeck.Deck
this.deck[cardcount] = new Card(suitit,rankit);
^
Deck.java:11: cannot find symbol
symbol : variable cardcount
location: class carddeck.Deck
cardcount++;
^
6 errors
Deck.java:
package carddeck;
class Deck {
public Deck () {
deck = new Card[51];
int cardcount = 0;
}
public void buildDeck () {
for (Card.Rank rankit: Card.Rank.values()) {
for (Card.Suit suitit: Card.Suit.values()) {
this.deck[cardcount] = new Card(suitit,rankit);
cardcount++;
};
};
};
}