infinite for Loop

We should be always careful while working with loops. It is because if we mistakenly set test expression in such a way that it is never false, the for loop will run forever. This is called infinite for loop. For example,


\begin{lstlisting}
// Infinite for Loop
\par
class Infinite {
public static voi...
... i = 1; i <= 10; --i) {
System.out.println(''Hello'');
}
}
}
\end{lstlisting}

Here, the test expression (i <= 10) is never false and hello is printed infinite number to times (at least in theory).