Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Java Java-conversion Convert Boolean to String

Related Tutorials


Share on Google+Share on Google+

Convert Boolean to String

In this section, we are going to convert a Boolean type data into a string.

Convert Boolean to String


In this section, we are going to convert a Boolean type data into a string. 

Code Description:

This program helps you in converting the Boolean type data into a string. The toString() method reads the Boolean type object and it converts into a string format. This method returns a string object and represents the boolean?s value. The Boolean object represents either ?true? or ?false". 

Here is the code of this program:

import java.util.*;

public class BooleanToString{
  public static void main(String[] args){
  boolean b = true;
  String s = new Boolean(b).toString();
  System.out.println("String is:"+ s);

Download this program:

Output this program.

C:\corejava>java BooleanToString
String is:true

If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 4, 2007

Related Tutorials

Discuss: Convert Boolean to String  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image