Difference between for loop and For-each loop in java?

  • The difference between for loop and For-each loop are as follows.. 
    for loop For-each loop
     1.for loop is a feature added from version.  1. For-each loop is a new feature added from jdk 1.5 version.
     2.for loop is used to performed repeatation process until and unless condition become false. 2.For-each loop is used to modify the collection dynamically.
     3.Rapid Modification does not affect the code.  3.Rapid Modification affect the code.
     4.In for loop loop, no technique is used.  4.In For-each loop, auto-boxing and unboxing technique are used.
     5.for loop support increment and decrement operator. 5. For-each loop does not support any increment and decrement operator.
    6.Syntax:

    for(initialization, condition, increment/decrement)

    {

    Statements;

    }

     6.Syntax:

    for(Variable:Collection)

    {

    Statements;

    }

     

     7. Example:  7.Example: