Indeed the boolean
primitive datatype can be either true
or false
:
boolean received; // defaults to false
For a 3rd state you can use a Boolean type instead, which can be null
in addition to true
or false
:
Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Boolean.html
Boolean received; // defaults to null