Posts

Showing posts from January, 2017
For more Computer Science, Linux, C++ content visit ProgrammerCave
Follow us on Facebook | Instagram | Telegram

Contribute on Paypal

JAVA: Enhanced For Loop

Image
Enhanced for loop was introduced in JAVA 5 as a simple way to iterate all the elements of a collection. It is useful when scanning a array instead of using for loop.  Here we will take a simple example to sum all the elements of an array     public class EnhancedForLoop {        public static void main(String[] args) {        int  arr[]={3,2,4,5};        int sum=0;        
For more Computer Science, Linux, C++ content visit ProgrammerCave
Follow us on Facebook | Instagram | Telegram

Contribute on Paypal