Is there a nullable data type in java like int?, char?... in C#? Is there a way to create it as a class or something?
Need to create data type which will be able to hold null as well as number values.
Is there a nullable data type in java like int?, char?... in C#? Is there a way to create it as a class or something?
Need to create data type which will be able to hold null as well as number values.
int
is not nullable in JavaInteger
is a class that contains a abstraction for int
and can be null
You could use Integer
since its nullable;
https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html
The same goes for Boolean
.
basically they're class wrappers over the primitive types.