Java Reference
In-Depth Information
to wrap double values into Double objects, and the class Float is used to wrap
float values into Float objects. In fact, Java provides a wrapper class corresponding
to each primitive data type. For example, the wrapper class corresponding to the type
int is Integer .
Next, we briefly discuss the class Integer . Table 6-6 describes some members of the
class Integer .
TABLE 6-6 Some Members of the class Integer
Named Constants
public static final int MAX_VALUE = 2147483647;
public static final int MIN_VALUE = -2147483648;
6
Constructors
public Integer( int num)
//Creates an object initialized to the value specified
//by num.
public Integer(String str)
//Creates an object initialized to the value specified
//by the num contained in str.
Methods
int compareTo(Integer anotherInteger)
//Compares two Integer objects numerically.
//Returns the value 0 if the value of this Integer object is
//equal to the value of anotherInteger object, a value less
//than 0 if the value of this Integer is less than the value of
//anotherInteger object, and a value greater than 0 if the value
//of this Integer object is greater than the value of
//anotherInteger object.
public int intValue()
//Returns the value of the object as an int value.
public double doubleValue()
//Returns the value of the object as a double value.
public boolean equals(Object obj)
//Returns true if the value of this object is equal
//to the value of the object specified by obj;
//otherwise returns false.
Search WWH ::




Custom Search