JAVA包装类Boolean的使用


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

  1. /** 
  2.  * 对于Boolean类使用了字符串构造方式,并且之后使用了toString()方法将true和false以字符串形式输出。 
  3.  * @author HAN 
  4.  * 
  5.  */  
  6. public class BooleanApps {  
  7.     Boolean b1=new Boolean("true");  
  8.     String str1= b1.toString();  
  9.       
  10.     Boolean b2=new Boolean("OK");  
  11.     String str2= b2.toString();  
  12.     public BooleanApps(){  
  13.         System.out.println(str1);  
  14.         System.out.println(str2);  
  15.     }  
  16.     public static void main(String[] args){  
  17.         new BooleanApps();  
  18.     }  
  19. }  

相关内容