Class DeckOfCards
Class DeckOfCards
(Fig. 7.10) declares as an instance variable a Card
array named deck
(line 7). An array of a reference type is declared like any other array. Class DeckOfCards
also declares an integer instance variable currentCard
(line 8) representing the sequence number (0–51) of the next Card
to be dealt from the deck
array, and a named constant NUMBER_OF_CARDS
(line 9) indicating the number of Card
s in the deck (52).
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.