Alan's Blog

导航

2012年8月21日 #

java多线程

摘要: java实现多线程有两种方式:一种是继承Thread类,另外一种是实现Runnable接口用个程序举例:/** * 继承Thread类,直接调用run方法 * */class Hello extends Thread { public Hello () { } public Hello (String name) { this.name = name; } public void run() { for (int i = 0; i < 5; i++) { System.out.println(name +... 阅读全文

posted @ 2012-08-21 22:59 Alan's Blog 阅读(389) 评论(0) 推荐(0) 编辑