I usually use an infinite loop, as shown below:
public static boolean start = false; while(!start) { doMyLogic(); }
but a friend said that you need to have a little delay inside the while-true loop (like below), otherwise it can cause memory problems, and is also not good practice.
The proposed method:
while(!start) { Thread.sleep(few_miliseconds);
Please inform me about the impact of the proposed method. Am I doing it right?
source share