- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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
- Related Articles
- Java Program to convert String to Boolean
- Java Program to convert boolean value to Boolean
- Golang Program to convert Boolean to String
- Convert Java String Object to Boolean Object
- Java Program to convert integer to boolean
- Java Program to convert boolean to integer
- C++ Program to convert Boolean Variables into String
- C++ Program to Convert String Type Variables into Boolean
- Golang Program to convert string type variables into Boolean
- Convert Java Boolean Primitive to Boolean object
- JavaScript Convert a string to boolean
- How to convert Boolean to String in JavaScript?
- How to convert String to Boolean in JavaScript?
- How to convert string to boolean in PHP?
- Java Program to create a boolean variable from string

Advertisements