Printing arrays with objects in Java
<p>First, I made a copy of the deck of cards. Then, I tried to use a method I created to print only the first seven cards of that copy deck (which I need to do 2 times). nextCard is a counter to keep track of where we are in the deck.</p>

<p>Here is my class:public class Deck</p>

<pre><code>{
    private Card[] deck;
    private int nextCard;   


    public Deck(){
        deck = new Card[53];

        nextCard = 0;

        for(int i = 0; i &lt; 52; i++){
            deck[i] = new Card(i);
            nextCard++;                 
        }

    }//Deck 

    public Deck(Deck existingDeck){//copy

        this.deck = new Card[52];

        for(int i=0; i &lt; 52; i++){
            this.deck[i] = new Card(existingDeck.deck[i]);

        }
        nextCard++;
    }

    public void shuffle(){

        Card crdTemp = new Card();
        Random random = new Random();
        int num;
        nextCard = 0;

        for(int i = 0; i &lt; 52; i++){
            num = random.nextInt (51);
            crdTemp = deck[i];
            deck[i] = deck[num];
            deck[num] = crdTemp;

            nextCard++;
        }
    }

    public Card dealACard(){
        Card crd = null;
        if(nextCard &gt; -1){
        crd = deck[nextCard];
        nextCard--;
        }
        return crd;
    }

    public String dealAHand(int handSize){
        Card crd = null;
        String cards = "";
        for(int i = 0; i &lt; handSize; i++){
            crd = dealACard();
            cards += crd.toString();
            //cards += dealACard().toString();
        }
        return cards;
    }

    public String toString(){

        String info = "";
        for(int i = 0; i &lt; 52; i++){
            deck[i].toString ( );
            info += deck[i];
            nextCard++;
        }
        return info;
    }

}
</code></pre>

<p>Then, in my driver:</p>

<pre><code>Deck bDeck = new Deck(aDeck);
        bDeck.toString();
        String[] sevenCards = new String[bDeck];

        for(int i = 0; i &lt; 7; i++){
            System.out.println ("Copy deck: ");
            sevenCards[i] = bDeck.toString();

        }

        for(int i = 0; i &lt; 7; i++){
            System.out.println (sevenCards[i]);
        }


    }
</code></pre>

<p>I assume I am assigning the entire bDeck to each sevenCards array element, but I don't know how to do it differently. I also assume there is a way to do it without trying to create a new array like this, but again, I've gone through a lot of different ideas and nothing has panned out. Would really appreciate some direction, thanks.</p>