public class dd {
public static void main(String []arg){
String s = "true";
boolean b = Boolean.valueOf("true").booleanValue();
System.out.println(b);
boolean b1 = Boolean.valueOf(s).booleanValue();
System.out.println(b1);
boolean b2 = Boolean.parseBoolean(s);
System.out.println(b2);
Boolean bb = new Boolean(s);
boolean b3 = bb.booleanValue();
System.out.println(b3);
}
}
字符串"true"转换为布尔型boolean「true」
最新推荐文章于 2024-06-26 19:02:48 发布