Boolean data type
The Boolean data type represents 0 (false) or 1 (true).
The computer is able to test the inequality or equality true or false.

Using Boolean Expressions: Predicate Method

  public boolean isOverdrawn()

  {

     return balance < 0;

  }

  if (harrysChecking.isOverdrawn())

  isDigit

  isLetter

  isUpperCase

  isLowerCase

  if (in.hasNextInt()) n = in.nextInt();


AND & OR & NOT

AND  (&&):
If there are two events joined by AND, both events have to be true for the result of join to be true.
For example, if x is between 100 and 200, you can write if (x >100 && x <200) ...

OR ( || )
If there are two events joined by OR, both events have to be false for the result of join to be false.
For example, if input can be 's' or 'S', you can write if (input == 's' || input == 'S') ...

NOT ( !)
Opposite of the original.

A

B

A && B

true

true

true

true

false

false

false

Any

false

A

B

A || B

true

Any

true

false

true

true

false

false

false

A

! A

true

false

false

true

Using Boolean Variables

married = input.equals("M");

  if (married) . . . else . . . if (!married) . . .

It is considered gauche to write a test such as

  if (married == true) . . . // Don't
if (character.isDigit(ch) == false) . . . // Don't

Just use the simpler test

  if (married) . . .
if (!Character. isDigit(ch)) . . .