I am trying to do something in Java and I need something to wait / delay for an amount of seconds in a while loop.
while (true) { if (i == 3) { i
Use this:
public static void wait(int ms) { try { Thread.sleep(ms); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } }
and, then you can call this method anywhere like:
wait(1000);