Computer Science, asked by oendrila8, 1 year ago

differentiate between empty and infinite loops with the help of an example of each in Java

Answers

Answered by durekhan123
1

Empty for loop: for loop which runs but does not do anything, it has an empty body:

For(int I=0; i<5; I++)

{

// Empty body … doing nothing here

}

Infinite for loop

For(int I=1; i>0; I++)

{

// This starts from I=1 till I is greater than 0.. and after every loop it increment i. So it's never going to stop… if you put something here inside this body or block that will get executed infinite times..

// If you don't put anything here , it will become infinite empty for loop

Answered by shamanthshamanp52jwf
0

Answer:

A null loop doesn't contains any statement in its body whereas an infinite loop repeats the execution for an endless iterations

Explanation:

Make me brainliest

Similar questions