Enhanced for Loop

   


Enhanced for Loop

The enhanced for loop (or "for each" loop) must be turned into a traditional loop.

5.0

1.4

for (type variable : array)
{
   body
}

for (int i = 0; i < array.length; i++)
{
   type variable = array[i];
   body
}

for (type variable : arrayList)
{
   body
}

for (int i = 0; i < arrayList.size(); i++)
{
   type variable = (typearrayList.get(i);
   body
}



       
    top



    Core Java 2 Volume I - Fundamentals
    Core Java(TM) 2, Volume I--Fundamentals (7th Edition) (Core Series) (Core Series)
    ISBN: 0131482025
    EAN: 2147483647
    Year: 2003
    Pages: 132

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net