package com.gxx.threads.study.test4; /** * 测试类-不共享变量,线程安全 * @author Gxx */ public class TestSafe { /** * main方法 * @param args */ public static void main(String[] args) { MyThread thead1 = new MyThread(); MyThread thead2 = new MyThread(); MyThread thead3 = new MyThread(); MyThread thead4 = new MyThread(); MyThread thead5 = new MyThread(); MyThread thead6 = new MyThread(); MyThread thead7 = new MyThread(); MyThread thead8 = new MyThread(); MyThread thead9 = new MyThread(); MyThread thead10 = new MyThread(); thead1.start(); thead2.start(); thead3.start(); thead4.start(); thead5.start(); thead6.start(); thead7.start(); thead8.start(); thead9.start(); thead10.start(); } }