Is there a mistake in this example of Volatile? How do you run it to keep it running?

would like to ask you gods, I want to get a use case of Volatile, this is the following code, according to the following code,
if I set the jvm run parameter to-server, it should always run, the program will enter an endless loop, but in fact
does not, this is why?

public class Main {


    public static void main(String[] args) {

        VolatileThread volatileThread = new VolatileThread();
        volatileThread.start();


        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        volatileThread.setContinue(false);

    }



}
 
public class VolatileThread extends Thread{

    private boolean isContinue = true;

    public void setContinue(boolean aContinue) {
        isContinue = aContinue;
    }

    @Override
    public void run() {


        while (isContinue){
            System.out.println("Continue");
        }

        System.out.println("end");

    }


}

I use IDEA to run the program. The following is a picture of my setting of running parameters:

is my parameter not set correctly? Or is the example incorrect?

Dec.14,2021

even if you don't add the volatile keyword to isContinue , JVM will eventually send the modified isContinue value Synchronize to other threads, and volatile will just notify other threads of the change to the shared data immediately.

if you want to keep the program running, you can change it like this:

public class VolatileThread extends Thread {
    private boolean isContinue = true;
    public void setContinue(boolean aContinue) {
        isContinue = aContinue;
    }
    @Override
    public void run() {
        boolean localContinue = isContinue;
        while (localContinue){
            System.out.println("Continue");
        }
        System.out.println("end");
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea8717-1ed5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea8717-1ed5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?