The toString() method of Java Boolean class returns a String corresponding to this Boolean object. It returns a string value “true”, if the defined object is true else it returns false.

Syntax

  1. public String toString()
  2. public static String toString(boolean b)

Parameters

The parameter ‘b’ represents the Boolean argument to be converted in String.

Return Value

The toString() method returns the String depicting this Boolean value.

Example 1

Output

Example 2

Output

Example 3

Output

Example 4

Output

Pin It on Pinterest

Share This