Was doing some Java code,What I tried was:
public class Tester {
public static void main(String args[]){
String str = "";
System.out.println(str.length());
}
}
and the length was as expected zero. and then I tried something like following
public class Tester {
public static void main(String args[]){
String str = ""+""+""+""+"";
System.out.println(str.length());
}
}
and the String length was again zero. So whats that "" thing is. What this append operation ""+""+""+""+"" is doing here. I hope it is doing something but the length was again Zero. I am not understanding these double quotes without any spaces.
There is something there,that is why it is not null,but whatever it is,it is of zero length,....not able to swallow this thing
EDIT: Why using empty Strings?Why not relying on null ?Just looking for clarifications....Although I am afraid of null ghost too :(