You state,
Now, I need to combine them into an array called Deck, which stands as such:
No, you need to create a class Card that has one field of each of the enums. Only after doing that can you create a Deck of your Cards. So do that -- create a Card class, give it at least two fields, one for each enum, plus an appropriate constructor, plus getters, plus a decent toString()
and then you're set.
Also, this is wrong:
public void fill() {
for (int i = 0; i<52;i++){ // get rid of this loop
for (Suit s : Suit.values()) {
for (Rank r : Rank.values()) {
cards[i]= new Card(r,s);
}
The code above will try to stuff 52 cards into each index spot. For instance, it will try to stuff all 52 cards into the cards[0] spot, same for the cards[1] item, and only the last Card will be added. You'll have an array of 52 King of Diamonds -- not what you want.
Instead, get rid of the outer loop, and instead increment the i inside your loop:
public void fill() {
int i = 0;
for (Suit s : Suit.values()) {
for (Rank r : Rank.values()) {
cards[i]= new Card(r,s);
i++; // increment i here
}
}
}