Home > Tutorial > Java Convert Boolean To String Example

Java Convert Boolean To String Example

Easily convert datatype of type Boolean to datatype String using the Boolean.toString() method of the Integer class. This method will return a String object representing the specified boolean. The string will either be “true” or “false”.

Java Convert Boolean To String Source Code

package com.jcd.java.tutorials;

public class JavaBooleanToString 

	public static void main(String[] args) 
		boolean jcdBoolean = true;
		String jcdString = Boolean.toString(jcdBoolean);
		System.out.println("Boolean as String: "+jcdString);


Java Convert Boolean To String Output

Boolean as String: true

Posted by


Smedley has been doing software development for years, which mainly docues on C and C++. In the past number of years, he has focused on Java programming.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2018 JavaCodeDepot