Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we call null String?

Tags:

java

I like to know why do we call null string. Where Strings are objects in java and objects can not be null only references can be null.

Can anybody elaborate on it?

like image 737
giri Avatar asked Jun 08 '26 18:06

giri


1 Answers

There's a bit of confusion here. I would expect 'null String' to be a String reference that doesn't actually reference a String (i.e. it's null). But this article claims a 'null string' to be an empty string.

For this reason, I try to talk about null references - i.e. references that point to nothing at all, rather than a valid object. And (to be clear) empty Strings. A 'null String' to me means the same as a null reference, but the latter term is clearer to me.

like image 83
Brian Agnew Avatar answered Jun 11 '26 11:06

Brian Agnew