How to Declare a Boolean Variable

This will declare a Boolean Variable

boolean was added in API Level 1
The wrapper for the primitive type boolean. Boolean represents a true or false state.

1. Create an Android project, if you don't already have one.

2.In the MainActivity.java file, add the following code to the onCreate method. This creates a boolean variable named myBoolean

    boolean myBoolean;

3. Compile and run!

Next Recommended Article: Set a Boolean Variable

Resources: