public class ThreadDemo05 { public static void main(String args[]) { // 四个售票点应该控制同一个资源 Demo d = new Demo() ; Thread t1 = new Thread(d) ; Thread t2 = new Thread(d) ; Thread t3 = new Thread(d) ; Thread t4 = new Thread(d) ; t1.start() ; t2.start() ; t3.…
1.多线程实例 package second; public class A implements Runnable { public char stat = '*'; public void run(){ for(int i = 1;i <= 10 ; i++){ for(int y=1;y<=i;y++){ System.out.print(stat); } System.out.println(); } } public static void main(String args[]){…