Notes 3/12/2009 Boolean Operators AND && OR || NOT ! X Y = X && Y X || Y !X ------------------------------------- T T = T T F T F = F T F F T = F T T F F = F F T AND: The result will be TRUE only when both operands are TRUE. Otherwise the result will be FALSE. OR: The result will be when when at least one of the operands is TRUE. Otherwise the result will be FALSE. NOT: The result will be TRUE when the operand is FALSE. Otherwise the result will be FALSE. To determine if a value is within a range we use the AND operator. Example to check if a value in between 5 to 10 (inclusive) // Assume the value is in the variable val1 if ( (val1 >= 5) && (val1 <= 10) ) { System.out.println("The value is between 5 to 10"); }