Java.lang.Boolean.booleanValue() 方法


Java.lang.Boolean.booleanValue() 方法

package com.codingdict;



import java.lang.*;



public class BooleanDemo {



   public static void main(String[] args) {



      // create a Boolean object b

      Boolean b;



      // assign value to b

      b = new Boolean(true);



      // create a boolean primitive type bool

      boolean bool;



      // assign primitive value of b to bool

      bool = b.booleanValue();



      String str = "Primitive value of Boolean object " + b + " is " + bool;



      // print bool value

      System.out.println( str );

   }

}