Java Integer example to unwrap the Integer class to int type using intValue


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

Program:
package com.candidjava;

public class IntegerIntValue
{    
	public static void main(String args[])
	{      
	 Integer m=new Integer(10);    
	 int i=m.intValue();
	 int j=m;     
	 System.out.println(m+" "+i+" "+j);    
	}
}    

Output:
10 10 10

Description:
      The Wrapper class Integer is being converted to Primitive type int.

Specified by:
intValue in class Number

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


Related Post

Comments


©candidjava.com