Loops are used to execute a set of instructions repeatedly when some conditions become true.
loops can be controlled two ways
Entry Controlled Loop
Exit Controlled Loop
Loop, where test condition is checked before entering the loop body, known as Entry Controlled Loop.
Example: while loop, for loop
Loop, where test condition is checked after executing the loop body, known as Exit Controlled Loop.
Example: do while loop
There are three types of loops in java.
1)for loop
Syntax:
for (initialization ; testing condition; increment/decrement)
{
statement(s)
}
2)while loop
syntax:
initialization
while (boolean condition)
{
loop statements…
}
3)do-while loop
Syntax:
initialization
do
{
statements..
}
while (condition);
Other important posts links ::
- What is noun? Short explanation
- Online Hindi tutor in Bangalore 8181969432
- Hindi Language Tutors for CBSE ICSE ISC & State Board | Free Demo Class
- Pronic number program in Java
- Loops in Java-while,for, do while
- Buzz number program in java
- Operators and Operands in Java C C++
- Important question for ICSE Board class 10th computer application exam