分析程序,写出结果class MyThread1 extends Thread{private String name;public MyThread1(String name){this.name=name;}@Overridepublic void run() {for(int i=0;i<10;i++){System.out.println(name+i);}}}class MyThread2 implements Runnable{private String name;public MyThread2(String name){this.name=name;}@Overridepublic void run() {for(int i=0;i<10;i++){System.out.println(name+i);}}}class MyThread3 implements Runnable{private int ticket=5;@Overridepublic void run() {if(ticket>0){System.out.println("卖票:ticket="+ticket--);}}}class MyThread4 implements Runnable{@Overridepublic void run() {for(int i=0;i<3;i++){System.out.println(Thread.currentThread().getName()+"运行,i="+i);}}}class MyThread5 implements Runnable{private String name;private int time;public MyThread5(String name,int time){this.name=name;this.time=time;}@Overridepublic void run() {try {Thread.sleep(this.time);} catch (InterruptedException e) {e.printStackTrace();}System.out.println(this.name+"线程,休眠"+this.time+"毫秒");}}class MyThread6 implements Runnable{private int ticket=110;@Overridepublic void run() {for(int i=0;i<200;i++){synchronized(this){if(ticket>0){try {Thread.sleep(100);} catch (InterruptedException e) {e.printStackTrace();}System.out.println(Thread.currentThread().getName()+"卖票:ticket="+ticket--);}}}}}public class ThreadDemo1 {public static void main(String[] args) {MyThread6 mt=new MyThread6();Thread t1=new Thread(mt,"A");Thread t2=new Thread(mt,"B");Thread t3=new Thread(mt,"C");Thread t4=new Thread(mt,"D");Thread t5=new Thread(mt,"E");t1.start();t2.start();t3.start();t4.start();t5.start();}}