package cn.itcast_01;
public class 多线程方式2的思路及代码实现 {
public static void main(String[] args) {
MyRunnable my = new MyRunnable();
Thread t1 = new Thread(my,"第十八肯德基");
Thread t2 = new Thread(my,"阿克苏巨化股份");
t1.start();
t2.start();
}
}
public class MyRunnable implements Runnable {
@Override
public void run() {
for(int x =0;x<100;x++) {
System.out.println(Thread.currentThread().getName()+"-----"+x);
}
}
}
转载请注明原文地址:https://blackberry.8miu.com/read-3476.html