1 *java.lang.Boolean* *Boolean* The Boolean class wraps a value of the primitive t
3 public final class Boolean
4 extends |java.lang.Object|
5 implements |java.io.Serializable|
8 |java.lang.Boolean_Description|
9 |java.lang.Boolean_Fields|
10 |java.lang.Boolean_Constructors|
11 |java.lang.Boolean_Methods|
13 ================================================================================
15 *java.lang.Boolean_Fields*
16 |java.lang.Boolean_java.lang.Boolean.FALSE|
17 |java.lang.Boolean_java.lang.Boolean.TRUE|
18 |java.lang.Class<java.lang.Boolean>_java.lang.Boolean.TYPE|
20 *java.lang.Boolean_Constructors*
21 |java.lang.Boolean(boolean)|Allocates a Boolean object representing the value
22 |java.lang.Boolean(String)|Allocates a Boolean object representing the value
24 *java.lang.Boolean_Methods*
25 |java.lang.Boolean.booleanValue()|Returns the value of this Boolean object as a
26 |java.lang.Boolean.compareTo(Boolean)|Compares this Boolean instance with anoth
27 |java.lang.Boolean.equals(Object)|Returns true if and only if the argument is n
28 |java.lang.Boolean.getBoolean(String)|Returns true if and only if the system pr
29 |java.lang.Boolean.hashCode()|Returns a hash code for this Boolean object.
30 |java.lang.Boolean.parseBoolean(String)|Parses the string argument as a boolean
31 |java.lang.Boolean.toString()|Returns a String object representing this Boolean
32 |java.lang.Boolean.toString(boolean)|Returns a String object representing the s
33 |java.lang.Boolean.valueOf(boolean)|Returns a Boolean instance representing the
34 |java.lang.Boolean.valueOf(String)|Returns a Boolean with a value represented b
36 *java.lang.Boolean_Description*
38 The Boolean class wraps a value of the primitive type boolean in an object. An
39 object of type Boolean contains a single field whose type is boolean.
41 In addition, this class provides many methods for converting a boolean to a
42 String and a String to a boolean, as well as other constants and methods useful
43 when dealing with a boolean.
47 *java.lang.Boolean_java.lang.Boolean.FALSE*
49 The Boolean object corresponding to the primitive value false.
52 *java.lang.Boolean_java.lang.Boolean.TRUE*
54 The Boolean object corresponding to the primitive value true.
57 *java.lang.Class<java.lang.Boolean>_java.lang.Boolean.TYPE*
59 The Class object representing the primitive type boolean.
63 *java.lang.Boolean(boolean)*
65 public Boolean(boolean value)
67 Allocates a Boolean object representing the value argument.
69 Note: It is rarely appropriate to use this constructor. Unless a new instance
70 is required, the static factory (|java.lang.Boolean|) is generally a better
71 choice. It is likely to yield significantly better space and time performance.
73 value - the value of the Boolean.
75 *java.lang.Boolean(String)*
77 public Boolean(java.lang.String s)
79 Allocates a Boolean object representing the value true if the string argument
80 is not null and is equal, ignoring case, to the string"true". Otherwise,
81 allocate a Boolean object representing the value false. Examples:new
82 Boolean("True")produces a Boolean object that represents true.new
83 Boolean("yes")produces a Boolean object that represents false.
85 s - the string to be converted to a Boolean.
87 *java.lang.Boolean.booleanValue()*
89 public boolean booleanValue()
91 Returns the value of this Boolean object as a boolean primitive.
95 Returns: the primitive boolean value of this object.
97 *java.lang.Boolean.compareTo(Boolean)*
99 public int compareTo(java.lang.Boolean b)
101 Compares this Boolean instance with another.
104 b - the Boolean instance to be compared
106 Returns: zero if this object represents the same boolean value as the argument; a
107 positive value if this object represents true and the argument
108 represents false; and a negative value if this object represents
109 false and the argument represents true
111 *java.lang.Boolean.equals(Object)*
113 public boolean equals(java.lang.Object obj)
115 Returns true if and only if the argument is not null and is a Boolean object
116 that represents the same boolean value as this object.
119 obj - the object to compare with.
121 Returns: true if the Boolean objects represent the same value; false otherwise.
123 *java.lang.Boolean.getBoolean(String)*
125 public static boolean getBoolean(java.lang.String name)
127 Returns true if and only if the system property named by the argument exists
128 and is equal to the string"true". (Beginning with version 1.0.2 of the JavaTM
129 platform, the test of this string is case insensitive.) A system property is
130 accessible through getProperty, a method defined by the System class.
132 If there is no property with the specified name, or if the specified name is
133 empty or null, then false is returned.
136 name - the system property name.
138 Returns: the boolean value of the system property.
140 *java.lang.Boolean.hashCode()*
142 public int hashCode()
144 Returns a hash code for this Boolean object.
148 Returns: the integer 1231 if this object represents true; returns the integer 1237 if
149 this object represents false.
151 *java.lang.Boolean.parseBoolean(String)*
153 public static boolean parseBoolean(java.lang.String s)
155 Parses the string argument as a boolean. The boolean returned represents the
156 value true if the string argument is not null and is equal, ignoring case, to
157 the string"true". Example:Boolean.parseBoolean("True")returns true.
158 Example:Boolean.parseBoolean("yes")returns false.
161 s - the String containing the boolean representation to be parsed
163 Returns: the boolean represented by the string argument
165 *java.lang.Boolean.toString()*
167 public |java.lang.String| toString()
169 Returns a String object representing this Boolean's value. If this object
170 represents the value true, a string equal to"true"is returned. Otherwise, a
171 string equal to"false"is returned.
175 Returns: a string representation of this object.
177 *java.lang.Boolean.toString(boolean)*
179 public static |java.lang.String| toString(boolean b)
181 Returns a String object representing the specified boolean. If the specified
182 boolean is true, then the string"true"will be returned, otherwise the
183 string"false"will be returned.
186 b - the boolean to be converted
188 Returns: the string representation of the specified boolean
190 *java.lang.Boolean.valueOf(boolean)*
192 public static |java.lang.Boolean| valueOf(boolean b)
194 Returns a Boolean instance representing the specified boolean value. If the
195 specified boolean value is true, this method returns Boolean.TRUE; if it is
196 false, this method returns Boolean.FALSE. If a new Boolean instance is not
197 required, this method should generally be used in preference to the constructor
198 (|java.lang.Boolean|) , as this method is likely to yield significantly better
199 space and time performance.
204 Returns: a Boolean instance representing b.
206 *java.lang.Boolean.valueOf(String)*
208 public static |java.lang.Boolean| valueOf(java.lang.String s)
210 Returns a Boolean with a value represented by the specified string. The Boolean
211 returned represents a true value if the string argument is not null and is
212 equal, ignoring case, to the string"true".
217 Returns: the Boolean value represented by the string.