Software Technology Tips

The use of enhanced for loop enables us to loop through a collection member without knowing the size or explicitly iterating elements one by one . This feature is introduced with the Java SE platform in version 5.0.
 
Have a look how it simplifies programming.
 
Old form of looping.
 
for (int i=0; i <  nameArray.length; i++)
    {
       System.out.println("Name: " + array[i]);
    }
With Java SE 5.0. an enhanced looping would be like 
 
for (String name : nameArray)
 {
    System.out.println("Name: " + name);
  }
 
where nameArray is an array of Strings 


Related Tags:

Java

Author: Partho Banerjee

Related Pages

  • Java/JSP/Servlets Programming
  • Java Development Projects

Java

Let us Connect!

Awards and Achievements

Red Herringcolor DeloitteFast50 DB ZInnov1   Nascome

Events

serf DDM

This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2015. Login