As we know int is a primitive data type and cannot be null. In my program i want to do a condition check like int i != "" but it says operator != cannot be applied to int,null.
Any solution?
EDIT:
I already know that it cannot hold these two things i was trying to present my requiremnet for checking the parameter i am getting from another server if it has recived some value or if its empty.
You can use the Integer wrapper class for such comparisons. Otherwise the primitive int, if as a class field, defaults to 0 if not specified otherwise.
compiler never speak un-truth .
int can't hold so there is no need to check for ""
or null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With