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属于线程安全