For those of you who may be familiar with C++, but unfamilar with the
language Java, here are some features to note.
Java has no enumerated data types. Thus, the constants that represent color and suit are instead defined as integer constants, and given symbolic names.
There are no global variables or constants in Java. We will encounter this fact again later when we consider the game class.
Because there are no globals, singleton objects, that is, objects that have one one instantiation, are represented by static data fields. The example here is the list of symbolic integer values.
Unlike C++, variables and functions can be used before they are defined. This is true for classes as well.
The keyword final makes a single assignment value, it cannot be redefined.
The keyword representing the primitive boolean datatype is called boolean, this is similar to the bool datatype in C++.
We have here defined a number of accessor functions to access the rank and suit of a card. By using accessor functions, rather than providing direct access to the data fields, we protect these features, making them read-only.
Finally, the drawing operation is more complex, and is not shown on this slide.