The Boolean class wraps a primitive type boolean in an object. An object of type Boolean contains a single field whose type is boolean.
Boolean class has the methods for converting a boolean to a String and a String to a boolean.
| Type | Field | Summary |
|---|---|---|
| static Boolean | FALSE | The Boolean object value false. |
| static Boolean | TRUE | The Boolean object value true. |
| static Class<Boolean> | TYPE | The Class object representing the primitive type boolean. |
Convert to primitive boolean value
| Return | Method | Summary |
|---|---|---|
| boolean | booleanValue() | Returns the value as a boolean primitive. |
| Constructor | Summary |
|---|---|
| Boolean(boolean value) | Creates a Boolean object for value. |
| Boolean(String s) | Creates a Boolean object true value for string "true" igoring case. |
Compare two boolean values
| Return | Method | Summary |
|---|---|---|
| int | compareTo(Boolean b) | Compares this Boolean instance with another. |
| boolean | equals(Object obj) | Returns true if the argument is not null and is a Boolean object that represents the same boolean value as this object. |
Get boolean system property
| Return | Method | Summary |
|---|---|---|
| static boolean | getBoolean(String name) | Gets system property. |
Parse boolean value from string
| Return | Method | Summary |
|---|---|---|
| static boolean | parseBoolean(String s) | Parses the string argument as a boolean. |
| static Boolean | valueOf(boolean b) | Returns a Boolean instance representing the specified boolean value. |
| static Boolean | valueOf(String s) | Returns a Boolean with a value represented by the specified string. |
Convert boolean value to string
| Return | Method | Summary |
|---|---|---|
| String | toString() | Returns a String object representing this Boolean's value. |
| static String | toString(boolean b) | Returns a String object representing the specified boolean. |
java2s.com | | Contact Us | Privacy Policy |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |