I'm trying to learn some basic java programming for games.
I'm following this tutorial here.
Their skeleton code for the run method in an applet:
public void run ()
{
// lower ThreadPriority
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
// run a long while (true) this means in our case "always"
while (true)
{
// repaint the applet
repaint();
try
{
// Stop thread for 20 milliseconds
Thread.sleep (20);
}
catch (InterruptedException ex)
{
// do nothing
}
// set ThreadPriority to maximum value
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
}
}
In this code they initially set the thread priority to minimum. Then inside the loop they set it to maximum.
I was wondering what the purpose of this is?