Often our programs face questions that can only be answered with yes or no.

Is the oven on? Is the light green? Did I eat breakfast?

These questions are answered with a boolean, a type that references one of two values: true or false.

We declare boolean variables by using the keyword boolean before the variable name.

boolean javaIsACompiledLanguage = true; boolean javaIsACupOfCoffee = false;

In future lessons, we’ll see how boolean values help navigate decisions in our programs.



Create a variable called intsCanHoldDecimals. Set it to true if the int type can hold a decimal number. Set it to false if the int type cannot do this.


Print out your intsCanHoldDecimals variable.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?