|
|
These 2 words are keywords (reserved words) in Java
boolean NameOfVariable ; |
Notes:
|
public class Boolean01 { public static void main(String[] args) { boolean a; // boolean typed variable a = true; System.out.println(a); // prints true a = false; System.out.println(a); // prints false a = (3 > 1); // 3 > 1 evals to true, so: a = true System.out.println(a); // prints true a = (3 <= 1); // 3 <= 1 evals to false, so: a = false System.out.println(a); // prints false } } |
How to run the program:
|
|