Using a basic example to illustrate my problem I have 2 near-identical bits of code.
This code causes the while loop to run infinitely.
private boolean loadAsset() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            // Do something
            loaded = true;
        }
    }).start();
    while (!loaded) {
        // System.out.println("Not Loaded");
    }
    System.out.println("Loaded");
    return false;
}
This code however (i.e. doing something in the while loop) causes the loaded variable to be successfully evaluated and allows the while loop to break and method to finish. 
private boolean loadAsset() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            // Do something
            loaded = true;
        }
    }).start();
    while (!loaded) {
        System.out.println("Not Loaded");
    }
    System.out.println("Loaded");
    return false;
}
Can anyone explain to me why this is?
 
     
     
     
     
    