Share on Google+Share on Google+

java.lang.String.valueOf(boolean bool)

Advertisement
The given example shows how to convert the boolen value into string.

The given example shows how to convert the boolen value into string. Basically the "bool" parameter of the valueof method converts the boolean value into the string.

a simple example of valueof(boolean bool) method in Java.

public static void main(String[] args)
{
String Strtrue = String.valueOf(true);
String Strfalse = String.valueOf(false);

//will display the boolean values.
System.out.println(Strtrue);
System.out.println(Strfalse);
}
}

The output is:
true
false

Advertisements

Posted on: March 22, 2005 If you enjoyed this post then why not add us on Google+? Add us to your Circles

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.

Comments:0