0

When i try to split a String "Element" into a String array, and then print out the result i get an output which i don't understand. My code is as follows:

String element = mapArray.get(i);
elementSplit = element.split("(?!^)");
System.out.println(elementSplit);

And the output produced when i print the String Array is:

[Ljava.lang.String;@3dee2310

Could someone please advise, as i do not know why it is printing this output.

Thanks very much

2 Answers2

1

You have to use Arrays.toString method.

System.out.println(Arrays.toString(elementSplit));
Anirban Nag 'tintinmj'
  • 5,392
  • 4
  • 35
  • 51
0

Due to speed You should use toCharArray method instead of split("(?!^)") and in order to print array you should use Arrays.toString method

String element = mapArray.get(i);
elementSplit = element.toCharArray();
System.out.println(Arrays.toString(elementSplit));
Melih Altıntaş
  • 2,455
  • 18
  • 35