In this section, you will learn to convert an integer type data into a string type.
Convert an Integer into a String
In this section, you will learn to convert an integer type data into a string type. The java.lang package provides this conversion functionality through toString() method.
Code Description:
This program takes an integer number at the console and it converts it into a string format using the Integer(str).toString() method. The given number takes an integer number that must be converted into an string format. The toString() method convert Integer number to string number.
toString():
The toString() method converts an integer value into a String.
Here is the code of this program:
import java.io.*;
|
Output this program.
C:\corejava>java IntegerToString Enter the integer value! 24 string: 24 C:\corejava> |