Monday, 16 December 2013

How to add item to arraylist in java

How to add item to arraylist in java

List<String> someList = new ArrayList<String>()
 // add "monkey", "donkey", "skeleton key" to someList
someList.add(monkey1);
someList.add(donkey2);
someList.add(skeleton key3);
someList.add(tesrt4);

for(String item : someList )
{

 System.out.println(item);

 }

iterate through list java 

No comments:

Post a Comment