How does one println print out the whole array list? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does one println print out the whole array list?

I was surprised to see the whole arraylist printed out with a single println statement. I would have thought a loop would be necessary. Is this because of a toString method that's part the arraylist class?

29th Jan 2017, 1:02 PM
John Myers
John Myers - avatar
1 Answer
0
But you have that output [1, 2, 3, 4]. How about if you want a single element or print it on a separate lines or without a paranthesses (here you can use substring).
2nd Feb 2017, 5:59 AM
Иван Иванов
Иван Иванов - avatar