Home How does the Java 'for each' loop work?
Reply: 0

How does the Java 'for each' loop work?

user369
1#
user369 Published in June 20, 2018, 10:50 pm

Consider:

List<String> someList = new ArrayList<String>();
// add "monkey", "donkey", "skeleton key" to someList
for (String item : someList) {
    System.out.println(item);
}

What would the equivalent for loop look like without using the for each syntax?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322539 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO