Conditional and logical operators

Learn to use boolean values in Java, a necessary tool for loops and conditionals.

A boolean variable can hold either the value true or the value false. Boolean values are quite useful when directing a program to take repeated actions, or to take actions only under some circumstances.

Note that Java’s true and false values are written with lowercase, unlike Python’s.

Get hands-on with 1200+ tech skills courses.