I have a array of strings say {"ABCD","EFGH", "IJKL", "MNOP"} I'm reversing the array as well as individual string within the array and I expect the output to be array of strings but the output obtained in string . Below is my code
public class ReverseString {
String s = "";
public static void main(String[] args) {
ReverseString rs = new ReverseString();
String value = "";
String arr[] = { "ABCD", "EFGH", "IJKL", "MNOP" };
for (int i = arr.length - 1; i >= 0; i--) {
value = rs.reverseArray(arr[i]);
}
System.out.println(value);
}
public String reverseArray(String arr1) {
for (int k = arr1.length() - 1; k >= 0; k--) {
s += arr1.charAt(k);
}
return s.toString();
}
}
and output is PONMLKJIHGFEDCBA.
How to convert it to array again ?