Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Convert Integer to primitive int example

  1. /*
  2.  * Convert Integer to primitive int example. Program to convert Java
  3.  * Integer object to primitive int data type.
  4.  */
  5.  
  6. public class IntegerToInt {
  7.  
  8.  public static void main(String args[]){
  9.  
  10.   //new Integer object
  11.   Integer iObj = new Integer("23");
  12.  
  13.   //Use intValue method of Integer wrapper to convert it to int
  14.   int i = iObj.intValue();
  15.  
  16.   System.out.println("Integer converted to int: " + iObj);
  17.  
  18.  }
  19. }
Your rating: None Average: 2 (2 votes)
Share this

Post new comment