/**
* Created by holten.gao on 2016/10/17.
*/
public class threadThread extends Thread {
public threadThread(String name) {
super(name);
}
@Override
public void run() {
System.out.println(this.getName()+" start!");
for(int i=0;i<10;i++){
System.out.println(this.getName()+" "+i);
try {
Thread.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
/**
* Created by holten.gao on 2016/10/17.
*/
public class runnableThread implements Runnable {
@Override
public void run() {
System.out.println(Thread.currentThread().getName()+" start!");
for(int i=0;i<10;i++){
System.out.println(Thread.currentThread().getName()+" "+i);
try {
Thread.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
/**
* Created by holten.gao on 2016/10/17.
*/
public class Main {
public static void main(String[] args) {
Thread threadThread=new threadThread("threadThread");
threadThread.start();
Thread runnableThread=new Thread(new runnableThread(),"runnableThread");
runnableThread.start();
}
}
threadThread start! threadThread 0 runnableThread start! runnableThread 0 threadThread 1 runnableThread 1 threadThread 2 runnableThread 2 threadThread 3 runnableThread 3 threadThread 4 runnableThread 4 threadThread 5 runnableThread 5 threadThread 6 runnableThread 6 threadThread 7 runnableThread 7 threadThread 8 runnableThread 8 threadThread 9 runnableThread 9
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有