Returns an object of the specified Type with the value t.
public staticTypevalueOf(String str)
Returns an object of the specified Type with the value parsed from str.
Float.valueOf("6.02e23") and Integer.valueOf("16") are
examples. Character does not have this method just as it does not have the
string-converting constructor.
These methods may return a newly constructed instance or a cached instance. For efficiency, you should
always use one of the valueOf methods, in preference to direct construction, unless you really need distinct
instances that have the same value.
8.1.2. Constants
Each of the wrapper classes, with the exception of Boolean define the following three fields:
public static finaltypeMIN_VALUE
The minimum value representable by this data type. For example, for
Integer this is 2^31.
public static finaltypeMAX_VALUE
The maximum value representable by this data type. For example, for
Integer this is 2^31 1.
public static final intSIZE
The number of bits used to represent a value of this type. For example, for
Integer this is 32.
All the wrapper classes define the following field:
public static final Class<Type>TYPE
A reference to the Class object that represents primitives of this type. These
fields are equivalent to the Class objects you can obtain from .class
class literal expressions as described in "Class Literals" on page 169. For
example, Integer.TYPE is the same Class object you will get from the
expression int.class. Note that int.class and Integer.class
yield two different Class instances, both of type Class<Integer>.
8.1.3. Common Methods
Each of the wrapper classes implements the Comparable
public intcompareTo(Typeother)
Returns a value less than, equal to, or greater than zero as the object on which
it is invoked is less than, equal to, or greater than the object (of the same type
Type) passed as a parameter.