Let me introduce you to the components of my problem. A Array called cards that has been created in the main method. A class called Card that has 2 class variables, suit and number. A ArrayList called ph (stands for playerHand) in a public class called Hand and finally a static public variable called counter. So now let me explain my dilemma.
In the main method the Array cards contains 52 card objects each with their own data. In the hand class I have a method called draw().
Here is some of the code inside the hand class.
ArrayList<Card> ph = new ArrayList<Card>();
public static int cc = 0;
void draw() {
ph.add(new Card());
ph.get(cc).num = cards[cc].num;
ph.get(cc).suit = cards[cc].suit;
cc = cc + 1;
}
However I have the following error on the 2 lines before cc = cc + 1. "cards cannot be resolved to a variable"
How do I transfer the data between the Array and the ArrayList?
EDIT: This is different from the post this is marked as a duplicate of because here the array is in a different class so that solution wouldn't work.