Specifications
Sun Services
Java™ Programming Language
Module 7, slide 15 of 44
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Old-Style Enumerated Type Idiom
Enumerated types are a common idiom in programming.
0
1 package cards.domain;
2
3 public class PlayingCard {
4
5 // pseudo enumerated type
6 public static final int SUIT_SPADES = 0;
7 public static final int SUIT_HEARTS = 1;
8 public static final int SUIT_CLUBS = 2;
9 public static final int SUIT_DIAMONDS = 3;
10
11 private int suit;
12 private int rank;
13
14 public PlayingCard(int suit, int rank) {
15 this.suit = suit;
16 this.rank = rank;
17 }










