DeckOfCards
Constructor
The class’s constructor uses a for
statement (lines 20–23) to fill the deck
instance variable with Card
objects. The loop initializes control variable count
to 0
and loops while count
is less than deck.length
, causing count
to take on each integer value from 0 through 51 (the deck
array’s indices). Each Card
is instantiated and initialized with two String
s—one from the faces
array (which contains the String ...
Get Java How to Program, Early Objects, 11th 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.