歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> JAVA包裝類Boolean的使用

JAVA包裝類Boolean的使用

日期:2017/3/1 10:44:18   编辑:Linux編程

對於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. Boolean b2=new Boolean("OK");
  10. String str2= b2.toString();
  11. public BooleanApps(){
  12. System.out.println(str1);
  13. System.out.println(str2);
  14. }
  15. public static void main(String[] args){
  16. new BooleanApps();
  17. }
  18. }
Copyright © Linux教程網 All Rights Reserved