Quantcast
Viewing all articles
Browse latest Browse all 30

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

Using forEach:

int[] numbers = {1,2,3,4,5};Arrays.stream(numbers).forEach(System.out::println);

Response:

12345The process finished with exit code 0

PS: You need a Array (int[] numbers), and import java.util.Arrays;


Viewing all articles
Browse latest Browse all 30

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>