Why is null == null false in Java?

4 Answers. You can’t compare null to a boolean . They are different types one indicating a null reference pointer and the other one a false/not true value. Thus the answer is: No this expression is not even valid and if it was, it would be false .

Sizin İçin Seçtik  Can you use == null in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *

Why is null == null false in Java?

4 Answers. You can’t compare null to a boolean . They are different types one indicating a null reference pointer and the other one a false/not true value. Thus the answer is: No this expression is not even valid and if it was, it would be false .

Sizin İçin Seçtik  Can we check integer null in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *