Computer Science, asked by ravinaagrahari1637, 11 months ago

Write a program on javato show the use of integer wrapper class methoda

Answers

Answered by shivaramdhanush
0

// Java program to demonstrate Unboxing

import java.util.ArrayList;

 

class Unboxing

{

   public static void main(String[] args)

   {

       Character ch = 'a';

 

       // unboxing - Character object to primitive conversion

       char a = ch;

 

       ArrayList<Integer> arrayList = new ArrayList<Integer>();

       arrayList.add(24);

 

       // unboxing because get method returns an Integer object

       int num = arrayList.get(0);

 

       // printing the values from primitive data types

       System.out.println(num);

   }

}

Similar questions