Convert String Object to Boolean Object - Java Language Basics

Java examples for Language Basics:boolean

Description

Convert String Object to Boolean Object

Demo Code


public class Main {
 
  public static void main(String[] args) {
    String str = "false";
   //  w w w .  java2 s . c  om
    Boolean blnObj1 = new Boolean(str);
    System.out.println(blnObj1);
   
    Boolean blnObj2 = Boolean.valueOf(str);
    System.out.println(blnObj2);
  }  
}

Result


Related Tutorials