© Doug Winnie 2021
D. WinnieEssential Java for AP CompScihttps://doi.org/10.1007/978-1-4842-6183-5_28

28. Boolean Values and Equality

Doug Winnie1  
(1)
Mission Hills, KS, USA
 

You have heard that everything with computers comes down to binary, or yes and no answers. That is true, and you can use that in your programs using Boolean values and logic operators. Boolean variables contain, and only contain, the values true or false. To determine a true or false response, there are a number of operators called logic operators that evaluate an equation as either true or false. You can then take that value and work with it or assign it to a Boolean variable.

Creating a Boolean Variable

Boolean variables can only contain two values: true or false. To create ...

Get Essential Java for AP CompSci: From Programming to Computer Science now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.