Question: Below I have a Constructor that creates a deck of cards: public Deck2(){ cardDeck = new Card2[numCards]; for(r=2;r <15;r++) { for(s = 1;s <5;s++) {

Below I have a Constructor that creates a deck of cards:

public Deck2(){ cardDeck = new Card2[numCards]; for(r=2;r<15;r++) { for(s = 1;s<5;s++) { int x = (r-3)+s; cardDeck[x]= new Card2(r,s); } } }

But i get this Output:

[2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A, A, A, A, null, null, null, null, null, null,..]

any way i can modify the constructor to print all the cards

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!