标签:ble java多线程 int print class 重写 nts system runnable
实现多线程有两种方式,第一种方式,实现runnable接口,第二种方式,继承thread类
重写run方法
public class Runnable1 implements runnable{
public void run(){
for(int i=0;i<5;i++){
System.out.printLn("Thread"+i);
}
}
}
public class Test{
Runnable1 run1 = new Runnable1();
Thread t1 = new Thread(run1);
Thread t2 = new Thread(run1);
t1.start();
}
标签:ble java多线程 int print class 重写 nts system runnable
原文地址:http://www.cnblogs.com/minshia/p/6724947.html