 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert Boolean to String
To convert Boolean to String in Java, use the toString() method. For this, firstly, we have declared two booleans.
boolean bool1 = false; boolean bool2 = true;
Now, convert Boolean to String using the toString() method in Java as shown below −
String str1 = new Boolean(bool1).toString(); String str2 = new Boolean(bool2).toString();
Now, when you will display the values “str1” and “str2”, the output would be in String.
Let us now see the complete example to convert Boolean to String.
Example
public class Demo {
   public static void main(String[] args) {
      boolean bool1 = false;
      boolean bool2 = true;
      String str1 = new Boolean(bool1).toString();
      String str2 = new Boolean(bool2).toString();
      System.out.println(str1);
      System.out.println(str2);
   }
}
Output
false true
Advertisements
                    