Computer Science, asked by Aratrika03, 1 year ago

difference between infinite and empty loop in Java

Answers

Answered by uzairhussain10p9nioi
36
An empty loop is a loop that doesn't contain any executable statement, whereas, an infinite loop is a loop that runs an infinite number of times.

Aratrika03: thank-you so much
uzairhussain10p9nioi: you're welcome
Answered by jojothegreat43p9sm75
32
An empty loop contain only one empty statement.They are mostly used to produce time breaks.
Ex-for(int a=0;a<10;a++)
      ;
It may also be written as-
     for(int a=0;a<10;a++);

An infinite loop on the other hand continues forever.
Ex-for(int a= 10; ;)
        ...Other statements
or
      for(int a=10;a>1;;)
         ...Other statement

Similar questions