+ 2

Can I consider s as null string? S==null will be true?

String s = "";

23rd Jan 2020, 4:01 PM
Hichem GOUIA
Hichem GOUIA - avatar
2 Respostas
+ 9
According to me,both are different coz String s="" represent an empty string and null represent no value or no storage location. For more detailed information check this: https://stackoverflow.com/questions/4802015/difference-between-null-and-empty-java-string
23rd Jan 2020, 4:05 PM
Ketan [#Be Happy 😄]
Ketan [#Be Happy 😄] - avatar
0
If you need a true statemet for an empty string, you can check its length. len(s)==0 (you can even ignore the "==0", because 0 == False, 1 == True. any values above 1 is also True)
24th Jan 2020, 8:50 AM
Kryto
Kryto - avatar