vendredi 24 octobre 2014

Java - How to create an array list using a contructor from another class that sets the values


Vote count:

0




Im trying to add a complete list of cards. I'm trying to add the 'cards' using the cards constructor using the array list and i want to input the suit and number.


In "Card" class:



Card(Suit suit, int rank){
this.suit = suit;
this.rank = rank;
}


In "Deck" Class:



Deck(){
ArrayList cards = new ArrayList(52);

for (int i=0; i<=13; i++){
cards.add(Card(SPADES,i)); //Trying to use the constuctor from the other class
}
}


When doing the above, the "SPADES" is underlined and it says cannot find symbol.



asked 2 mins ago







Java - How to create an array list using a contructor from another class that sets the values

Aucun commentaire:

Enregistrer un commentaire