The part I don’t understand is the point of having the String representation of null be the String “null”. What’s the rationale behind that functionality in Java?
Is there a deeper answer than “that’s just the way it is” in Java?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to see that a value is null, you expect to see null.
prints
And
prints as you would expect
As to why C# doesn’t do this, I don’t know. I imagine the designers made different assumptions about what
nullmeans. IMHO it shouldn’t be the same as an empty string.