java 线程安全问题

public class ThreadA  implements Runnable{
    public static int number;
    public String test;
    @Override
    public void run() {

        while(true){
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

  number是共享资源,属于非线程安全,test属于线程安全

posted @ 2016-09-27 22:36  Fly_Coding  阅读(115)  评论(0编辑  收藏  举报