วันศุกร์ที่ 25 กรกฎาคม พ.ศ. 2557

Java java.lang Boolean valueOf(boolean b)

Java java.lang Boolean valueOf(boolean b)

Description Of Boolean: valueOf(boolean b)

The java.lang.Boolean.valueOf(boolean b) returns a Boolean instance representing the specified boolean value. If the specified boolean value is true, this method returns Boolean.TRUE; if it is false, this method returns Boolean.FALSE.

If a new Boolean instance is not required, this method should generally be used in preference to the constructor Boolean(boolean), as this method is likely to yield significantly better space and time performance.

Boolean.valueOf(boolean b) method returns a Boolean instance representing b.

Code Example Java Boolean


public class BooleanExam {
 public static void main(String[] args) {
  boolean bool1 = true;
  boolean bool2 = false;

  Boolean b1 = Boolean.valueOf(bool1);
  Boolean b2 = Boolean.valueOf(bool2);

  // print b1, b2 values
  System.out.println(b1);
  System.out.println(b2);
 }
}


yengo หรือ buzzcity

ไม่มีความคิดเห็น :

แสดงความคิดเห็น