In this example we will show how to convert a int value to Integer object in Java.
Source Code
package com.beginner.examples;
public class ConvertIntToInteger {
public static void main(String[] args) {
int i = 22;
// Create an Integer object that uses the value of int
Integer integer = new Integer(i);
System.out.println(integer);
}
}
Output:
22