Android convert int to string java

Android-convert-int-to-string-java-featured.png

Convert an Integer into a String

Android convert int to string java1 Android convert int to string java

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.*;
import java.lang.*;

public class IntegerToString {
public static void main(String[] args) throws IOException{
BufferedReader read =
new BufferedReader(new InputStreamReader(System.in));
System.out.println(“Enter the integer value!”);
String str = read.readLine();
String s = new Integer(str).toString();
System.out.println(“String:=” +s);
}
}

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)