Write a program in java to demonstrate intValue() method?

class WrapperIntValue

{

                public static void main(String arg[])

                {

                                //Converting Integer to int

                                Integer a=new Integer(7);

                                int i=a.intValue();             //Converting Integer to int

                                int j=a;  //Unboxing, Now compiler will write a.intValue() internally

                                System.out.println(a+" "+i+" "+j);

                }

}

intValue() method.PNG

, , , , , ,

Leave a Reply