I have been always using
a != null
to check that a is not a null reference. But now I’ve met another way used:
a.ne(null)
what way is better and how are they different?
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.
Like @Jack said
x ne nullis equal to!(x eq null). The difference betweenx != nullandx ne nullis that!=checks for value equality andnechecks for reference equality.Example: