How to convert String[] to String in Java without using for loop ?
I know how to convert using for loop but I want to convert it without using any loop (for or while).
How to convert String[] to String in Java without using for loop ?
I know how to convert using for loop but I want to convert it without using any loop (for or while).
Use Arrays.toString() to convert it.
Returns a string representation of the contents of the specified array. If the array contains other arrays as elements, they are converted to strings by the Object.toString() method inherited from Object, which describes their identities rather than their contents.
Arrays.toString()
Example
String[] arr = new String[2];
arr[0] = "Str 1"; arr[1] = "Str 2";
System.out.println(Arrays.toString(arr));