Card in Java

This slide shows a typical class definition in Java. The Java language does not have enumerated data types, so the class begins with a series of definitions for constant values that we will use as symbolic constants. These are declared static and final, meaning there is only one copy, and they will be defined once.

Data fields have been declared private, as in the C++ version.

Other features are very similar to the C++ example.

Note: the static modifiers were unintentially omitted from the code in the textbook.
[audio] [real] Text to accompany slide28, in Chapter 3 of An Introduction to Object-Oriented Programming