- Boolean Class
- Remarks
- Constructors
- Properties
- Methods
- Operators
- Explicit Interface Implementations
- Extension Methods
- Class Boolean
- Field Summary
- Constructor Summary
- Method Summary
- Methods declared in class java.lang.Object
- Field Details
- TRUE
- FALSE
- TYPE
- Constructor Details
- Boolean
- Boolean
- Method Details
- parseBoolean
- booleanValue
- valueOf
- valueOf
- toString
- toString
- hashCode
- hashCode
- equals
- getBoolean
- compareTo
- compare
- logicalAnd
- logicalOr
- logicalXor
- describeConstable
Boolean Class
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The Boolean class wraps a value of the primitive type boolean in an object.
[Android.Runtime.Register("java/lang/Boolean", DoNotGenerateAcw=true)] public sealed class Boolean : Java.Lang.Object, IConvertible, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable, Java.Lang.IComparable
[] type Boolean = class inherit Object interface IConvertible interface ISerializable interface IJavaObject interface IDisposable interface IJavaPeerable interface IComparable
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
Allocates a Boolean object representing the value argument.
Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string «true» .
Properties
Returns the runtime class of this Object .
The Boolean object corresponding to the primitive value false .
The handle to the underlying Android instance.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
The Boolean object corresponding to the primitive value true .
The Class object representing the primitive type boolean.
Methods
Returns the value of this Boolean object as a boolean primitive.
Creates and returns a copy of this object.
Compares two boolean values.
Compares this Boolean instance with another.
Indicates whether some other object is «equal to» this one.
Returns true if and only if the system property named by the argument exists and is equal to, ignoring case, the string «true» .
Returns a hash code value for the object.
Returns a hash code for a boolean value; compatible with Boolean.hashCode() .
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
Returns the result of applying the logical AND operator to the specified boolean operands.
Returns the result of applying the logical OR operator to the specified boolean operands.
Returns the result of applying the logical XOR operator to the specified boolean operands.
Wakes up a single thread that is waiting on this object’s monitor.
Wakes up all threads that are waiting on this object’s monitor.
Parses the string argument as a boolean.
Returns a string representation of the object.
Returns a String object representing the specified boolean.
Returns a Boolean instance representing the specified boolean value.
Returns a Boolean with a value represented by the specified string.
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
Causes the current thread to wait until either another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or a specified amount of time has elapsed.
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
Operators
Explicit Interface Implementations
IComparable.CompareTo(Object) | |
IConvertible.GetTypeCode() | |
IConvertible.ToBoolean(IFormatProvider) | |
IConvertible.ToByte(IFormatProvider) | |
IConvertible.ToChar(IFormatProvider) | |
IConvertible.ToDateTime(IFormatProvider) | |
IConvertible.ToDecimal(IFormatProvider) | |
IConvertible.ToDouble(IFormatProvider) | |
IConvertible.ToInt16(IFormatProvider) | |
IConvertible.ToInt32(IFormatProvider) | |
IConvertible.ToInt64(IFormatProvider) | |
IConvertible.ToSByte(IFormatProvider) | |
IConvertible.ToSingle(IFormatProvider) | |
IConvertible.ToString(IFormatProvider) | |
IConvertible.ToType(Type, IFormatProvider) | |
IConvertible.ToUInt16(IFormatProvider) | |
IConvertible.ToUInt32(IFormatProvider) | |
IConvertible.ToUInt64(IFormatProvider) | |
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
Performs an Android runtime-checked type conversion.
Class Boolean
The Boolean class wraps a value of the primitive type boolean in an object. An object of type Boolean contains a single field whose type is boolean .
In addition, this class provides many methods for converting a boolean to a String and a String to a boolean , as well as other constants and methods useful when dealing with a boolean .
This is a value-based class; programmers should treat instances that are equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail.
Field Summary
Constructor Summary
Method Summary
Returns true if and only if the argument is not null and is a Boolean object that represents the same boolean value as this object.
Returns true if and only if the system property named by the argument exists and is equal to, ignoring case, the string «true» .
Methods declared in class java.lang.Object
Field Details
TRUE
FALSE
TYPE
Constructor Details
Boolean
It is rarely appropriate to use this constructor. The static factory valueOf(boolean) is generally a better choice, as it is likely to yield significantly better space and time performance. Also consider using the final fields TRUE and FALSE if possible.
Boolean
It is rarely appropriate to use this constructor. Use parseBoolean(String) to convert a string to a boolean primitive, or use valueOf(String) to convert a string to a Boolean object.
Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string «true» . Otherwise, allocates a Boolean object representing the value false .
Method Details
parseBoolean
Parses the string argument as a boolean. The boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string «true» . Otherwise, a false value is returned, including for a null argument. Example: Boolean.parseBoolean(«True») returns true .
Example: Boolean.parseBoolean(«yes») returns false .
booleanValue
valueOf
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.
valueOf
Returns a Boolean with a value represented by the specified string. The Boolean returned represents a true value if the string argument is not null and is equal, ignoring case, to the string «true» . Otherwise, a false value is returned, including for a null argument.
toString
Returns a String object representing the specified boolean. If the specified boolean is true , then the string «true» will be returned, otherwise the string «false» will be returned.
toString
Returns a String object representing this Boolean’s value. If this object represents the value true , a string equal to «true» is returned. Otherwise, a string equal to «false» is returned.
hashCode
hashCode
equals
Returns true if and only if the argument is not null and is a Boolean object that represents the same boolean value as this object.
getBoolean
Returns true if and only if the system property named by the argument exists and is equal to, ignoring case, the string «true» . A system property is accessible through getProperty , a method defined by the System class. If there is no property with the specified name, or if the specified name is empty or null, then false is returned.
compareTo
compare
Boolean.valueOf(x).compareTo(Boolean.valueOf(y))
logicalAnd
logicalOr
logicalXor
describeConstable
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.