Quantcast
Channel: In detail, how does the 'for each' loop work in Java? - Stack Overflow
Viewing all articles
Browse latest Browse all 61

Answer by Jrovalle for In detail, how does the 'for each' loop work in Java?

$
0
0

In Java 8 features you can use this:

List<String> messages = Arrays.asList("First", "Second", "Third");void forTest(){    messages.forEach(System.out::println);}

Output

FirstSecondThird

Viewing all articles
Browse latest Browse all 61

Trending Articles