Difference between various string comparisons in Java
Posted
by Gandalf StormCrow
on Stack Overflow
See other posts from Stack Overflow
or by Gandalf StormCrow
Published on 2010-04-14T15:37:08Z
Indexed on
2010/04/14
15:53 UTC
Read the original article
Hit count: 160
java
Is there a difference between these ?
if(myString.equals("")){
}
if(myString.equals(null)){
}
if(myString == ""){
}
I have a string, I don't know is it empty or has some emtpy spaces I just wan't to stop it to be written in database if it is invalid(if empty or with some blank spaces).
© Stack Overflow or respective owner