1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
/* Convert int to Integer object Example This example shows how a int primitive value can be converted to Integer object */ public class IntToIntegerExample { public static void main(String[] args) { int i = 10; /* Use Integer constructor to convert int primitive type to Integer object. */ Integer intObj = new Integer(i); System.out.println(intObj); } } /* Output of the program would be 10 */ |
Doesn’t work…