... of Clubs Queen of Clubs Queen of Spades Six of Clubs Nine of Spades Four of Hearts Jack of Clubs Five of Spades King of Spades Jack of Spades Queen of Hearts 

Lines 44–49 populate the deck array with cards that have unique face and suit combinations. Both Face and Suit are public static enum types of class Card. To use these enum types outside of class Card, you must qualify each enum’s type name with the name of the class in which it resides (i.e., Card) and a dot (.) separator. Hence, lines 44 and 45 use Card.Suit and Card.Face to declare the control variables of the for statements. Recall that method values of an enum type returns an array that contains all the constants of the enum type. Lines 44–49 use enhanced for statements to construct 52 ...

Get Java How To Program, Late 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.