摘要:
1 class MyThreadA implements Runnable{ 2 private boolean flag=true; 3 public void run(){ 4 int i=0; 5 while(this.flag){ 6 while(true){ 7 System.out.println(Thread.currentThread().getName()+"运行,i="+(i++)); 8 } 9 }10 }11 }12 ... 阅读全文
posted @ 2012-03-13 21:05
谈笑风生膜法师
阅读(291)
评论(0)
推荐(0)
摘要:
1 class MyThread implements Runnable{ 2 private boolean flag=true; 3 public void run(){ 4 int i=0; 5 while(this.flag){ 6 while(true){ 7 System.out.println(Thread.currentThread().getName()+"运行,i="+(i++)); 8 } 9 }10 }11 p... 阅读全文
posted @ 2012-03-13 20:49
谈笑风生膜法师
阅读(285)
评论(0)
推荐(0)
摘要:
1 class ZhangSan{ 2 public void say(){ 3 System.out.println("Zhang said:you should lend your painting to me!"); 4 } 5 public void get(){ 6 System.out.println("Zhang has got it!"); 7 } 8 } 9 class LiSi{10 public void say(){11 System.out.println("Li said:yo... 阅读全文
posted @ 2012-03-13 20:06
谈笑风生膜法师
阅读(450)
评论(0)
推荐(0)
摘要:
1 class MyThread implements Runnable{ 2 private int ticket=5; 3 public void run(){ 4 for(int i=0;i<100;i++){ 5 synchronized (this){ 6 if(ticket>0){ 7 try{ 8 Thread.sleep(300); 9 }catch(Interr... 阅读全文
posted @ 2012-03-13 19:47
谈笑风生膜法师
阅读(543)
评论(4)
推荐(0)

浙公网安备 33010602011771号