Online Java Compiler By
JavaTpoint.com
public class BooleanBooleanValueExample1 { public static void main(String[] args) { // here we have created boolean object b Boolean b1 = new Boolean(true); boolean b2; //assigning boolean value of b1 to b2 b2= b1.booleanValue(); String str1 = "1. Value of boolean object "+b1+" is "+b2+"."; System.out.println(str1); System.out.println(); Boolean b3 = new Boolean(true); //assigning boolean value of b3 to b4 boolean b4 = b3.booleanValue(); String str2 = "2. Value of boolean object "+b1+" is "+b2+"."; System.out.println(str2); } }
Output