by @kodeazy
Java How to cast Integer object to int primitve data type?
- To convert
Integer object
type toint
primitive data type we need to cast the the variable toint
type. -
Below is the syntax to convert
Object
type toint
typeInteger temp=1; int t1=(int)temp;
-
Below is the example code to convert
Object
type toint
type.class CheckType{ public static void main(String args[]){ Integer temp=1; int t1=(int)temp; System.out.println(t1); } }
Output:
1