You are here: Home / Topics / Looping in JAVA and Types of Loops in JAVA

Looping in JAVA and Types of Loops in JAVA

Filed under: JAVA Interview Questions on 2022-07-02 16:08:18

If we want to execute a statement or a block of statements repeatedly in java, then loops are used. And such a process is known as looping. There are basically 3 types of looping. They are: –

  • "For loop": – for executing a statement or a set of statements for a given number of times, for loops are used. It is used when the programmer knows the number of times a statement is to be executed.
  • "While loop": – in this, a particular statement or set of statements are executed until a particular condition is fulfilled. In this, before the execution of statements, the condition is checked. It is known as an entry controlled loop.
  • "Do While loop": – there is only one difference between the while and do-while loop and that is- in do-while loop, the condition is checked after the execution of the block of statements. It is known as an exit controlled loop.
About Author:
V
Vishal Gupta     View Profile
Hi, I am Vishal Gupta. I like this Website for learning MCQs. This website is good for preparation.