boolean <variable name> = <default value>;
public class Boolean { public static void main(String[] args) { boolean b1 = true; boolean b2 = false; boolean b3 = (13> 2)? true:false; System.out.println("Value of boolean variable b1 is :" + b1); System.out.println("Value of boolean variable b2 is :" + b2); System.out.println("Value of boolean variable b3 is :" + b3); } }
Output: |
---|
Value of boolean variable b1 is : true |
Value of boolean variable b2 is : false |
Value of boolean variable b3 is : true |