怎么没有运行的结果:
- package cn.itheima.test;
- public class TickeDemo {
- public static void main(String[] args) {
- Thread t1 = new Thread();
- Thread t2 = new Thread();
- Thread t3 = new Thread();
- Thread t4 = new Thread();
- t1.start();
- t2.start();
- t3.start();
- t4.start();
- }
-
- class Ticket extends Thread{
- private int tick=100;
- public void run(){
- while(true){
- if(tick>0)
- System.out.println(Thread.currentThread().getName()+"sale:"+tick--);
- }
- }
- }
- }
复制代码
|