Java TutorialLesson 13Free preview
Java Booleans
This lesson is part of Java · All levels
Summary
The boolean type only holds two logical values, namely true or false, and is the main material of the condition in the program. Boolean values are usually derived from comparison operations such as age > 17 or from methods that return checks. With booleans, you can create programs that make decisions based on specific conditions.
Key points
- The boolean can only contain true or false, no other value
- Boolean values are often generated from comparison operators such as ==, >, and!=
- Operator! reverses the boolean value:
- The results of logical expressions && (and) and ∫ (or) are also boolean
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.