- class Ticket extends Thread
- {
- private int tick = 100 ;
- public void run()
- {
- while(true) // 这个while 判断的是什么?有点不明白
- {
- if (tick>0)
- {
- System.out.println(currentThread().getName()+"tick: "+tick--);
- }
- }
- }
- }
- class TicketDemo
- {
- public static void main(String[] args)
- {
- Ticket t1 = new Ticket();
- Ticket t2 = new Ticket();
- Ticket t3 = new Ticket();
- Ticket t4 = new Ticket();
- t1.start();
- t2.start();
- t3.start();
- t4.start();
- }
- }
复制代码 while 判断的是什么?有点不明白?
|