The JavaTM Tutorial
Previous Page Lesson Contents Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Trail: Learning the Java Language
Lesson: Classes and Inheritance

Answers to Questions and Exercises: Enumerated Type

Exercises

Exercise 1: Rewrite the class Card from the exercise in Questions and Exercises: Creating Classes (in the Learning the Java Language trail) so that it represents the rank and suit of a card with enum types.
Answer 1: See Card3.java (in a .java source file), Suit.java (in a .java source file), and Rank.java (in a .java source file).

Exercise 2: Rewrite the Deck class.
Answer 2: See Deck3.java (in a .java source file).


Previous Page Lesson Contents Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.