English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Boolean literals have two values, namely True and False.
The following is an example of displaying boolean literals.
public class Demo { public static void main(String[] args) { System.out.println("Boolean Literals"); boolean one = true; System.out.println(one); one = false; System.out.println(one); } }
Output Result
Boolean Literals true false
In the above program, we declared a boolean value and assigned the boolean literal 'true'.
boolean one = true;
Similarly, we added another boolean literal 'false'.
one = false;
Display the following two values, which are boolean literals.