Monday, 16 December 2013

iterate through list using for each in java

 iterate through list using for each 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);

 }



No comments:

Post a Comment