Can anyone tell me why the if statement never passes please. I have put the lines that are shown in the terminal window under the code. (the System.out.println() )
The bottom two System.out's are just a test to see if they are changing and they do but the if statement doesn't see they are the same.
int listPosition = 0;
while(listPosition < basket.size())
item = basket.get(listPosition);
if(itemName.toLowerCase() == item.getName().toLowerCase())
System.out.println(itemName + " Removed");
Terminal window shows this:
So they are the same and the toLowerCase is working but for some reason the if statement doesn't see them as the same, why is this?