In this Java tutorial, you will learn about Integer.intValue() method, and how to use this method to get value of this Integer object as int, with the help of examples.

Integer.intValue()

Integer.intValue() returns the value of this Integer as an int.

Syntax

The syntax of intValue() method is

</>
Copy
Integer.intValue()

Returns

The method returns value of type int.

Example

In this example, we will take an Integer object and get its int value using Integer.intValue() method.

Java Program

</>
Copy
public class Example {
	public static void main(String[] args){
		Integer integer = 20;
		int result = integer.intValue();
		System.out.println("Result of intValue() = " + result);
	}
}

Output

Result of intValue() = 20

Conclusion

In this Java Tutorial, we have learnt the syntax of Java Integer.intValue() method, and also how to use this method with the help of Java example programs.