If you haven’t completed the previous exercises in Chapter 12 then do so now.
Open Card.java and add the following class variables.
public static final String[] RANKS = {null,"Ace","2","3","4","5","6",
"7","8","9","10","Jack","Queen","King"};
public static final String[] SUITS = {"Clubs","Diamonds","Hearts","Spades"};
Comment the previous toString method’s content and replace it with the class variables.
public String toString(){
// String[] ranks = {null,"Ace","2","3","4","5","6","7","8","9",
// "10","Jack","Queen","King"};
// String[] suits = {"Clubs","Diamonds","Hearts","Spades"};
// String s = ranks[this.rank] + " of " + suits[this.suit];
// return s;
return RANKS[this.rank] + " of " + SUITS[this.suit];
}