boolean Data Type

boolean Literals

The Boolean literals hold the value of either true or false. Lets declare the isLogged variable with the literal values of true and false.

boolean loggedIn = true;

Assign the value to the false literal.

boolean loggedIn = false;

Boolean can only have the value of either true or false. They can not hold any other value. Most boolean identifiers start with the is prefix.

More Examples

boolean isAuthenticated = false;
isAuthenticated = true;

results matching ""

    No results matching ""