/java-bootcamp

🚀 Learning about Java #hhman #personal

Primary LanguageJava

java-bootcamp

🚀 Learning about Java #hhman #personal

Booleans

Boolean in Java are represented by the boolean type, which values can be either true or false.

Java supports three operators:

  • ! (NOT): negates the boolean
  • && (AND): takes two booleans and results in true if they're both true
  • || (OR): results in true if any of the two booleans is true

Examples

!true // => false
!false // => true
true && false // => false
true && true // => true
false || false // => false
false || true // => true