What is the difference between null
and the ""
(empty string)?
I have written some simple code:
String a = "";
String b = null;
System.out.println(a == b); // false
System.out.println(a.equals(b)); // false
Both statements return false
. It seems, I am not able to find what is the actual difference between them.
You may also understand the difference between null and an empty string this way:
Original image by R. Sato (@raysato)