![]() |
![]() |
![]() |
![]() |
![]() |
|
You can declare variables to have boolean type.
You can assign either of the literal Boolean values, true or
false, to such variables. Note that, although the Reverend Boole
no doubt spelled his name with an uppercase B, the boolean
type is marked with a lowercase boolean keyword.
public class Demonstrate {
public static void main (String argv[]) {
boolean b;
b = (2 + 2 == 4);
System.out.println(b);
}
}
--- Result ---
true