The List
interface supports random access via the get
method - to get line 0, use list.get(0)
. You'll need to use array access on that, ie, lines.get(0)[0]
is the first element of the first line.
See the javadoc here.
The toString
method of array types in Java isn't particularly meaningful, other than telling you what that is an array of.
You can use java.util.Arrays.toString
for that.
Or if your lines only contain numbers, and you want a line as 1,2,3,4...
instead of [1, 2, 3, ...]
, you can use:
java.util.Arrays.toString(someArray).replaceAll("\\]| |\\[","")
At this point:
for (String[] s : myEntries) {
System.out.println("Next item: " + s);
}
You need to join the array of Strings in a line. Check this post: A method to reverse effect of java String.split()?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With