Computer Science, asked by ENRIQUEpriyansh2763, 1 year ago

You are given an integer , you have to convert it into a string.

Answers

Answered by abhishekvashispdhjwk
0
Convert using Integer.toString(int)

The Integer class has a static method that returns a String object representing the specified int parameter. Using this is an efficient solution.

Syntax 

public static String toString(int i)

The argument i is converted and returned as a string instance. If the number is negative, the sign will be preserved.

Example 
int number = -782;
String numberAsString = Integer.toString(number);

The code is equivalent to: 
String numberAsString = "-782";
Similar questions