I have doubt while taking a null or empty char check in Java. Is both have to be checked in any way.
For example in database the variable length for Char is 1 . It will allow null as well. So if you have empty char does it mean null? or we have to check as
if(someObject.getSomeCharValue()=='' && someObject.getSomeCharValue()==null) {
//true
}
else{
//dont compile
}
char has no value with
''. In char, null character (or empty char) is\0or\u0000. You can't check with''ornull.For example if you declare a char like this:
or
so if you want to check whether a char is null, then you need to use the following code: