Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (800 points)

How to convert String object to Boolean object?

1 Answer

0 votes
by (13.2k points)

 1. Convert using constructor

    Boolean blnObj1 = new Boolean(str);

    System.out.println(blnObj1);

    

    2. Use valueOf method 

        This is a static method of Boolean class.

    Boolean blnObj2 = Boolean.valueOf(str);

   System.out.println(blnObj2);

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Aug 6, 2019 in Java by Anvi (10.2k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...