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
  • 6
    Use Arrays#toString() method to print an array. Commented Feb 13, 2014 at 16:04
  • That could be the answer. Commented Feb 13, 2014 at 16:05

2 Answers 2

1

You have to use Arrays.toString method.

System.out.println(Arrays.toString(elementSplit));
Sign up to request clarification or add additional context in comments.

Comments

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));

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.