Integer
The Integer
class wraps the primitive type int
in an object. The Integer
class contains a variety of methods for converting int
values or dealing with the int
type in general.
Fields
Type | Name | Description |
---|---|---|
static final int | MAX_VALUE | a constant that holds the maximum value that an |
static final int | MIN_VALUE | a constant that holds the minimum value that an |
Method Details
Integer
Integer(int value)
Creates an Integer
object that represents the specified int
value.
Parameters
Name | Type | Description |
---|---|---|
value | int | the value to be represented by the |
Examples
Integer a = new Integer(23);
intValue
public int intValue()
Returns the value of the Integer
object as an int
.
Examples
Integer temp = new Integer(32);
int i = temp.intValue();
System.out.println("The integer value of i = " + i);
Output:
The integer value of i = 32
parseInt
static int parseInt(String s)
Returns the String
argument as an int
.
Parameters
Name | Type | Description |
---|---|---|
s | String | a |
Examples
int temp = Integer.parseInt("10");
System.out.println("Integer Value of String 10: " + temp);
Output:
Integer Value of String 10: 10