Convert String to boolean in Java
Description
The following code shows how to convert String to boolean.
Example
/*from w ww .jav a 2 s. c o m*/
public class Main {
public static void main(String[] args) {
String strBoolean = "true";
//String to boolean conversion
boolean theValue = Boolean.parseBoolean(strBoolean);
System.out.println(theValue);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »