I am trying for null check like below
if (isTrue == null)
compile error says : “The operator == is undefined for the argument type(s) boolean”
Please help, how to do null check.
Thanks
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.
You can’t do
nullcheck on primitive types.booleanis a primitive type.If you absolutely need to represent a
nullvalue with abooleanvariable, you need to use the wrapper classjava.lang.Boolean.So, your example would be:
Here’s the WIKIPEDIA entry for primitive wrapper classes.