How to Get an Integer String in Java


In this example, we learn how to convert a Integer object into String object.

Source Code

package com.beginner.examples;

public class GetStringInInteger {

	public static void main(String[] args) {

		Integer integer = new Integer(22);

		// Use the toString() method in the Integer object to get the string
		String strInt = integer.toString();

		System.out.println(strInt);

	}

}

Output:

22
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments