package com.lk.B; public class Test4 { private static final Object o1 = new Object(); private static final Object o2 = new Object(); private class Run1 implements Runnable{ @Override public void run() { // TODO Auto-generated method stub String threa…
public class MyThread extends Thread{ private static int ticket=100; public void run(){ for(int i=0;i<50;i++) if(ticket>0) System.out.println(Thread.currentThread().getName()+"正在卖第"+(ticket--)+"张票"); } //main函数是一个主线程 public stati…