JAVA包装类Boolean的使用

来源:互联网 发布:淘宝子账号怎么登录 编辑:程序博客网 时间:2024/05/20 10:15

对于Boolean类使用了字符串构造方式,并且之后使用了toString()方法将true和false以字符串形式输出。

/** * 对于Boolean类使用了字符串构造方式,并且之后使用了toString()方法将true和false以字符串形式输出。 * @author HAN * */public class BooleanApps {Boolean b1=new Boolean("true");String str1= b1.toString();Boolean b2=new Boolean("OK");String str2= b2.toString();public BooleanApps(){System.out.println(str1);System.out.println(str2);}public static void main(String[] args){new BooleanApps();}}