package com.brilliance.isc.voltest;

/**
 * @author gechengyang
 * @date 2023/2/16
 */
public class AnnotationTest {
    public static void main(String[] args) {
        seeByVolatile();
    }

    private static void seeByVolatile() {
        DataNum dataNum = new DataNum();
        new Thread(() -> {
            System.out.println("线程开始");
//            try {
//                Thread.sleep(100);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
            dataNum.num = 60;
            System.out.println("线程修改结束" + dataNum.num);
        }).start();

        while (dataNum.num == 0) {
            System.out.println("it is aways 0");
        }
        System.out.println("***************"+dataNum.num);

        System.out.println("程序已经结束");
    }

}
