I want to create an ArrayList of type Card
My Card class will have 2 instance variables of type Suit called suit and of type String called rank. The type Suit is its own subclass with 2 instance variables of type String called suitTitle and type Boolean called selected.
My card Class looks like this
public class Card {
public Suit suit;
public String rank;
With the constructor and all the obvious getters and setters
My Suit Class looks like this
public class Suit {
public String suitTitle;
public Boolean selected;
With the constructor and all the obvious getters and setters
When creating the cards First I need an Array of Suit type that will look like this
Suit[] suit = new Suit[4];
suit[0].suitTitle = "Spades";
suit[1].suitTitle = "Hearts";
suit[2].suitTitle = "Clubs";
suit[3].suitTitle = "Diamonds";
But when trying to put in the values, I get a nullpointer exception