首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

兑现runnable()接口

2012-12-19 
实现runnable()接口/*实现Runnable接口进行多线程操作*/package com.javasky.threadpublic class Thread_

实现runnable()接口

/*实现Runnable接口进行多线程操作*/

package com.javasky.thread;

public class Thread_test_1 implements Runnable {

?public static void main(String[] args) {
??for(int i=0 ;i<5 ;i++){
???Runnable runnable = new Thread_test_1();
???new Thread(runnable,"thread"+i).start();
??}
?}

?public void run() {
??for(int i=0 ;i<100 ;i++ ){
???System.out.println(Thread.currentThread().getName()+":"+i);
??}
?}
}

热点排行