摘要: 1,两种方法来创建线程:1)继承Thread类实现run方法:public class Hello1 extends Thread{ String name; public Hello1(String n) { name = n; } public void run() { for (int i=1; i<=10; i++) { System.out.println(name+" Hello "+i); } }}2)实现Runnable接口,实现run方法:public class Hello2 implements Runnable{ String name; pu 阅读全文
posted @ 2011-03-21 21:48 jinmengzhe 阅读(461) 评论(0) 推荐(2) 编辑