Java ArrayList initialization (easy question)

Posted by Jonathan on Stack Overflow See other posts from Stack Overflow or by Jonathan
Published on 2010-05-03T20:27:59Z Indexed on 2010/05/03 20:38 UTC
Read the original article Hit count: 314

Filed under:
|

I am aware that you can initialize an array during instantiation as follows:

String[] names = new String[] {"Ryan", "Julie", "Bob"};

Is there a way to do the same thing with an ArrayList? Or must I add the contents individually with array.add()?

Thanks,

Jonathan

© Stack Overflow or respective owner

Related posts about java

Related posts about arraylist