Could someone please help me understand why i'm getting a null pointer when adding to my array list. Im trying to make it so that it will change the text on a button when it is clicked, however my ArrayList does not seem to be adding the things into it?
public class Game {
private GUI gui;
private ArrayList<String> pairs;
boolean clicked;
public Game() {
gui = new GUI(this);
clicked = false;
ArrayList<String> pairs = new ArrayList<String>();
}
public void addPairs() {
pairs.add("dog"); // where i get the null pointer
pairs.add("dog");
}