by @kodeazy

Java How to cast Integer object to int primitve data type?

Home » java » Java How to cast Integer object to int primitve data type?
  • To convert Integer object type to int primitive data type we need to cast the the variable to int type.
  • Below is the syntax to convert Object type to int type

    Integer temp=1;
    int t1=(int)temp;
  • Below is the example code to convert Object type to int type.

    class CheckType{
    public static void main(String args[]){
    	Integer temp=1;
    	int t1=(int)temp;
    	System.out.println(t1);
    	
    }
    }

    Output:

    1