Print Page Print Page

CH12 – Cards Are Immutable

  1. Complete the previous exercises in Chapter 12 if you haven’t already.
  2. Modify the rank and suit variables so that they are final.
private final int rank;
private final int suit;
  1. Compile and run the CardDriver program.
$ javac
$ java CardDriver 2 3
Ace of Hearts
2 of King