- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert String to Boolean
To convert String to Boolean, use the parseBoolean() method in Java. The parseBoolean() parses the string argument as a boolean. The boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string "true".
Firstly, declare a string.
String str = "false";
Now, use the Boolean.parseBoolean() method to convert the above declared String to Boolean.
boolean bool = Boolean.parseBoolean(str);
Let us now see the complete example to learn how to convert String to Boolean.
Example
public class Demo { public static void main(String[] args) { // string String str = "false"; // string to boolean boolean bool = Boolean.parseBoolean(str); // returned boolean value System.out.println(bool); } }
Output
false
- Related Articles
- Java Program to convert Boolean to String
- Java Program to convert boolean value to Boolean
- Golang Program to convert Boolean to String
- Haskell Program to Convert Boolean to String
- Convert Java String Object to Boolean Object
- Java Program to convert integer to boolean
- Java Program to convert boolean to integer
- Swift program to convert boolean variable into string
- C++ Program to convert Boolean Variables into String
- Golang Program to convert boolean variables into string
- Haskell Program to convert boolean variables into string
- Golang Program to convert string type variables into Boolean
- Swift program to convert string type variable into boolean
- C++ Program to Convert String Type Variables into Boolean
- Convert Java Boolean Primitive to Boolean object

Advertisements