-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBooleanTest.java
32 lines (27 loc) · 1.16 KB
/
BooleanTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package java_core_basic;
/**
* Java ²¼¶ûÀàÐÍ
*
* @author ÌÆÁú
*/
public class BooleanTest {
public static void main(String[] args) {
Boolean b1 = true;
Boolean b2 = new Boolean(false);
boolean b3 = true;
System.out.println("b1:" + b1);
System.out.println("b2:" + b2);
System.out.println("b3:" + b3);
System.out.println("Boolean.TRUE:" + Boolean.TRUE);
System.out.println("Boolean.FALSE:" + Boolean.FALSE);
System.out.println("Boolean.getBoolean(\"true\"):" + Boolean.getBoolean("true"));
System.out.println("Boolean.getBoolean(\"0\"):" + Boolean.getBoolean("0"));
System.out.println("Boolean.getBoolean(\"\"):" + Boolean.getBoolean(""));
System.out.println("Boolean.getBoolean(\"true\"):" + Boolean.parseBoolean("true"));
System.out.println("Boolean.getBoolean(\"truee\"):" + Boolean.parseBoolean("truee"));
System.out.println("Boolean.valueOf(true):" + Boolean.valueOf(true));
System.out.println("Boolean.valueOf(false):" + Boolean.valueOf(false));
System.out.println("Boolean.valueOf(\"true\"):" + Boolean.valueOf("true"));
System.out.println("Boolean.valueOf(\"truee\"):" + Boolean.valueOf("truee"));
}
}