package ThreadABC; public class MyThread extends Thread { public static int status = 0; @Override public void run() { while (true) { synchronized (MyThread.class) { if ("A".equals(Thread.currentThread().getName()) && status < 30 &…
package ThreadABC; public class Share { private volatile int status; public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public Share(int status) { this.status = status; }} package ThreadABC; public c…