The types of loops in Java


Whenever you need to execute a block of code multiple times, a loop will often come in handy.

Java has 4 types of loops:

  • While Loop
  • Do…While Loop
  • For Loop
  • For Each Loop

Loops behaviour can be customized using:

  • Control Statements
    • Break Control Statement
    • Continue Control Statement

A special case of loops:

  • Infinite Loops