Convert boolean to string

ReturnMethodSummary
StringtoString()Returns a String object representing this Boolean's value.
static StringtoString(boolean b)Returns a String object representing the specified boolean.

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

The output:


true
true
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.