I have a JTextField that I'm not always passing a value to, but it causes an exception to be thrown when the program runs if the person hasn't entered anything into the JTextField. I have some code below that I'm trying to convert a null response into a different String value. Why isn't it assigning stringInput as a String of "0"?
Code:
String stringInput = " ";
stringInput = dinnerTextField.getText();
if (stringInput == null)
stringInput = "0";
Comment