摘要: 1 class MyThread implements Runnable{ 2 public void run(){ 3 for(int i=0;i<5;i++){ 4 try { 5 Thread.sleep(500); 6 } catch (Exception e){ 7 } 8 System.out.println(Thread.currentThread().getName()+"运行,i="+i); 9 }10 }11 }12 pu... 阅读全文
posted @ 2012-03-12 20:53 谈笑风生膜法师 阅读(279) 评论(0) 推荐(0)
摘要: 1 class MyThread implements Runnable{ 2 private String name; 3 public MyThread(String name){ 4 this.name=name; 5 } 6 public void run(){ 7 for(int i=0;i<10;i++){ 8 System.out.println(name+" 运行,i="+i); 9 }10 }11 }12 public class ThreadDemo {13 ... 阅读全文
posted @ 2012-03-12 19:51 谈笑风生膜法师 阅读(293) 评论(0) 推荐(0)
摘要: View Code 1 class MyThread extends Thread{ 2 private String name; 3 public MyThread(String name){ 4 this.name=name; 5 } 6 public void run(){ 7 for(int i=0;i<10;i++){ 8 System.out.println(name+"运行,i="+i); 9 }10 }11 }12 public class ThreadDemo {... 阅读全文
posted @ 2012-03-12 19:40 谈笑风生膜法师 阅读(164) 评论(0) 推荐(0)