How to check a Long for null in java

Primitive data types cannot be null. Only Object data types can be null.

There are 8 primitive types in Java:

Data Type Size Description
byte 1 byte Int8
short 2 bytes Int16
int 4 bytes Int32
long 8 bytes Int64
float 4 bytes Single
double 8 bytes Double
boolean 1 bit Boolean

If you use Long (wrapper class for long) then you can check for null‘s:

Long longValue = null;

if(longValue == null)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)