Showing posts from January, 2017

JAVA: Enhanced For Loop

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;

Popular Posts

Top 10 Web Sites Every Programmer Should Visit Daily

What is "namespace" and why do we use it?