Hi I'm using a GUI and adding the users input into a list from a textfield when they press a button however when the textbox is empty, im still having an empty value being added despite my if statement to try and prevent that. I have tried to use null as the condition also which does not work either. Thanks.
String data = addField.getText();
if(data!=""){ // need to figure out why its adding blanks still
myList.add(data);
addField.setText("");
System.out.println(data + " was added to the list");
}