class Demo implements Runnable 
{ 
        private int key =100; 
        public void run() 
        {        while(true) 
                {if (key>0) 
                { 
                        System.out.println(Thread.currentThread().getName()+"::"+key); 
                        key--; 
                } 
                } 
        } 
} 
class  A 
{ 
        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.start(); 
                        t4.start(); 
        } 
}为什么我把key--;写在下面却能输出四个100呢?请大家指教下 |   
        
 
    
    
    
     
 
 |