2
I’m a beginner in Java and would like to learn how to convert an array of integers into a String.
2
I’m a beginner in Java and would like to learn how to convert an array of integers into a String.
6
To convert a type matrix int
for a string
you should make use of the method .toString()
which is part of class java.util.Arrays
:
Returns a string representation of the Contents of the specified array.
That translated:
Returns a string representation of the content of the specified matrix.
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]
Browser other questions tagged java array string int whole
You are not signed in. Login or sign up in order to post.
Convert as? Type, if your array has the elements
10
,20
and30
the resulting string must be"102030"
? Please clarify your problem better, show us where you’re going and what you’ve been able to do so far (i.e. tell us what you know, so we can help you in what you don’t know).– mgibsonbr