if statement doesn´t recognize null nor ""
Posted on 2003-11-09
I am trying to use an if statement to select whether or not to execute a code. But I don´t know why it isn´t recognizing the null or blank .
I have the folowing code
if (aeroportoPartida.getCodigoAeroporto() == null || aeroportoPartida.getCodigoAeroporto() == "")
But it is not getting in it!!! this tests if a textField is blank.
I testeted with System.out.println(aeroportoPartida.getCodigoAeroporto()); to see if it was blank , and it prints nothing when it is blank , and when I write something in the text field it prints the thing I wrote!!
Why the if statement isn´t recognizing it??!! Is there another word or way to know what it would be if the text field is blank!!!