BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Java Integer intValue() Method

Last Updated: October 27, 2022 by Chaitanya Singh | Filed Under: java

The intValue() method of Integer class returns the value of this Integer object as int. You can use this method for Integer to int conversion.

Syntax of intValue() method

public int intValue()

intValue() Parameters

NA

intValue() Return Value

  • Returns the value represented by Integer object as int primitive data type.

Example 1

A value contained by Integer object is converted into an int primitive data type using intValue() method.

class JavaExample {
  public static void main(String args[]) {
    Integer iObj = new Integer(33);
    //This method is called using Integer object
    //and returns an equivalent int value
    int iNum = iObj.intValue();
    System.out.println("Integer to int: "+iNum);
  }
}

Output: