Control statement: – Used to control the flow of execution of program from one location to any other location inside program.

Type of control statement: –

  • Conditional control statement

Decision-making / selection

  1. If-else
  2. Switch-case

Iterative / looping

  1. For loop
  2. For-each loop
  3. While loop
  4. Do-while loop
  • Unconditional statement
  1. Break
  2. Continue
  3. Return

For-each loop: – This loop is adding in java specially to access the element of collection framework or element of array.

Syntax: –

For (variable:collection)
{
                _ _ _ _ _
                _ _ _ _ _
}
Advertisements