Articles → JAVA → Boolean.Valueof() In Java
Boolean.Valueof() In Java
Purpose
String value | Boolean.valueOf() method |
---|
True (or true) | True |
False (or false) | False |
null | False |
Other than true, false and null | False |
Example
public class Test {
public static void main(String[] args) {
System.out.println(Boolean.valueOf("True"));
System.out.println(Boolean.valueOf("False"));
System.out.println(Boolean.valueOf(null));
System.out.println(Boolean.valueOf("Test"));
}
}
Output
Click to Enlarge