package com.test.thread;public class TestThread { public static void main(String[] args) { TestThread testThread = new TestThread(); Thread thread1 = new Thread(new Thread1(testThread)); Thread thread2 = new Thread(new Thread2(testThread)); thread1.start(); thread2.start(); } public synchronized void show(String threadName,boolean flag,boolean isEnd){ for(int i=0;i
线程1和线程2,线程2执行一次,线程1执行一次。