I don'd understand the difference between a null String and an empty String in Java.
Suppose String a = null
, and I want to see if a is null by using a.isEmpty()
or a.equals("null")
. Neither of these works. I have to use a == null
to tell that if a is null
or not.
From my understanding, if you use ==
between two strings, you are actually comparing their addresses or references in memory? Is this understanding right? I hope someone can clarify my confusion. Thanks in advance.