How to Convert a Int Value into Integer Object in Java


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
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments