Use Boolean value constructors

Boolean(boolean value)
Creates a Boolean object for value.
Boolean(String s)
Creates a Boolean object true value for string "true" igoring case.

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

The output:


true
true
Home 
  Java Book 
    Essential Classes  

Boolean:
  1. Boolean class
  2. Get boolean value from constants in Boolean class
  3. Convert to primitive boolean value
  4. Use Boolean value constructors
  5. Compare two boolean values
  6. Get system property in boolean value
  7. Convert string to boolean
  8. Convert boolean to string