This program is supposed to save the button value "ab" to the ArrayList whenever the button is pressed, but the if command seems to never work, I tried removing it and seeing if it works, it does and the ArrayList is updated with the new value. So if I pressed the button or not when it appears in the J Windows, nothing happens.
This program later on saves the array to a file, so basically nothing is saved if the if is there and I clicked as many times I wanted, but if the if loop in this one goes then it works
public void actionPerformed(ActionEvent a)
{
ArrayList<String> aList = new ArrayList<String>();
if (a.getActionCommand() == "ab")
aList.add("ab");
}
So if this was done it world print out and aList would be filled with ab in the zero index :
public void actionPerformed(ActionEvent a)
{
ArrayList<String> aList = new ArrayList<String>();
aList.add("ab");
}