The foreach loop is completely ignoring my if statement.
for(InfoBox infoBox : mAbilities)
{
if(infoBox.CheckPressed(event));
{
//This is being outputted each time, even if the if statement returns false.
System.out.println(infoBox.getName());
}
System.out.println(infoBox.CheckPressed(event));
System.out.println(infoBox.getName());
}
You’ve prematurely terminated your
ifstatement with a semicolon:This makes the following block a freestanding block that will always execute.