A loop does not always stop. For example, if n = 10 then
i = 0; while(i != n) { System.out.println(i); }will never end. If you are using Linux and you suspect that your program is in an infinite loop, use control-C to stop it.
How can you stop a program that appears to be in an infinite loop in Linux? Answer