Java java.lang Boolean valueOf(String s)
Description Of Boolean: valueOf(String s)
The java.lang.Boolean.valueOf(String s) returns a Boolean with a value represented by the specified string. The Boolean returned represents a true value if the string argument is not null and is equal, ignoring case, to the string "true".
Boolean.valueOf(String s) method returns the Boolean value represented by the string.
Code Example Java Boolean
public class BooleanExam {
public static void main(String[] args) {
String s1 = null;
String s2 = "false";
Boolean b1 = Boolean.valueOf(s1);
Boolean b2 = Boolean.valueOf(s2);
// print b1, b2 values
System.out.println(b1);
System.out.println(b2);
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น