Java Reference
In-Depth Information
tional operators
<
and
>
are not defined. For
Character
, the comparison is
strictly numerical, with no consideration of alphabetic, or locale specific
ordering.
Each class provides a method to extract the wrapped value:
public
type
type
Value()
Returns the primitive value corresponding to the current
wrapper object. For example,
Integer.valueOf(6).intValue()
returns 6.
And each class overrides the following members of
Object
:
public String
toString()
Provides a string representation of the wrapper object's value.
For the numeric classes base 10 is always used.
public boolean
equals(Object obj)
Returns
true
if the two objects are the same type and wrap
the same value. For example, for two
Integer
objects
x
and
y
,
x.equals(y)
is true if and only if,
x.intValue()== y.intValue()
. If
obj
is not of the same type as the current object, or is
null
,
false
is returned.
public int
hashCode()
Returns a value-based hash code for use in hashtables.
The following additional methods convert primitive values to and from
strings:
public static
type
parse
Type
(String str)