What is the difference between null
and the \"\"
(empty string)?
I have written some simple code:
String a = \"\";
String b
null
means nothing; it means you have never set a value for your variable but empty means you have set "" value to your String
for instance see the following example:
String str1;
String str2 = "";
Here str1
is null
meaning that you have defined it but not set any value for it yet, but you have defined str2
and set empty value for it so it has a value even that value is "";
but