Facebook Page Twitter Page LinkedIn Page
× Java.lang Package Classes

The java.lang.Integer.intValue() method is used to return the value of this Integer as an int.


public int intValue()


No parameter is required.

Return Value

Returns the numeric value represented by this object after conversion to type int.




In the below example, the java.lang.Integer.intValue() method is used to return a Integer object as an int.

import java.lang.*;

public class MyClass {
  public static void main(String[] args) {
    //creating Integer objects
    Integer val1 = new Integer("25");
    Integer val2 = new Integer("-25");

    //printing intValue of the Integer objects
    System.out.println("intValue of the val1 is: " + val1.intValue()); 
    System.out.println("intValue of the val2 is: " + val2.intValue());   

The output of the above code will be:

intValue of the val1 is: 25
intValue of the val2 is: -25

❮ Java.lang - Integer