i have a string var, give it an example
String s = "just\nan\nexample";
i want to split that string into string array by using line space(\n) as delimiter, so the output string array will look like
String[] array = [just, an, example];
so then i tried this code
String[] array = s.split("\n");
System.out.println(array);
it gave me this output in the console
[Ljava.lang.String;@691aca
what's going on? am i using this method wrong?
EDIT: Okay, it's answered.. this is one of the answer
System.out.println(java.util.Arrays.toString(array));
but this make me questioned about something, i also have another string array which i put on the value from a txt file using bufferedreader loop and it can printed out array list seamlessly without using "java.util.Arrays.toString(array)"
but why when i use an array which i value i put on manually (as above) or get from another variable, i can't get it printed out properly without using "java.util.Arrays.toString(array)"?