Search code examples
javaintegerint

How to check whether a int is not null or empty?


I really dont know if this is possible or not. But I am strucking in a place where I want to check an int value is null or not, to call different methods.

Is there any way to do it?

Actually, variable comes from a browser with a null value. I cannot change the int declaration to Integer. Because it has it own consequences.

Any suggestions?


Solution

  • int variables can't be null

    If a null is to be converted to int, then it is the converter which decides whether to set 0, throw exception, or set another value (like Integer.MIN_VALUE). Try to plug your own converter.