Java – How to get the String representation of the Boolean value in Java ?

Problem statement

You need to convert the Boolean value to string and display the string representation of the same.


Use the toString static method defined in the Boolean class for the conversion.

public class Main {

    public static void main(String[] args) {

        System.out.println(" Java Tutorials");

        Boolean b1 = new Boolean("false");
        String str = Boolean.toString(b1);


The output of the above program is Java Tutorials


%d bloggers like this: