Java Data Type Tutorial - Java Boolean(boolean value) Constructor








Syntax

Boolean(boolean value) constructor from Boolean has the following syntax.

public Boolean(boolean value)

Example

In the following code shows how to use Boolean.Boolean(boolean value) constructor.

public class Main {
    public static void main(String[] args) {
       
       Boolean boolean2 = new Boolean(true);
       System.out.println(boolean2);
    }
}

The output: