boolean
primitives cannot be null
. You basically have two options I can see:
Have your function return a Boolean
(note the capital 'B'). Boolean
is an object, rather than a primitive, and so can be null
.
A better solution would be to define an enum. That helps you preserve the semantic meaning of the return value, which will make your code more readable and easier to maintain.