I am a beginner in Java and would like to learn how to convert an array of integers to a String.
I am a beginner in Java and would like to learn how to convert an array of integers to a String.
To convert an array of type int
to a string
you should use the #
Returns the string representation of the contents of the specified array.
What translated:
Returns a string representation of the contents of the specified array.
import java.util.Arrays;
public class Main {
public static void main(final String[] args) {
final int[] matriz = new int[] { 1, 2, 3 };
System.out.println(Arrays.toString(matriz));
}
}
[1, 2, 3]