0
点赞
收藏
分享

微信扫一扫

java96-线程的睡眠

//线程的睡眠
public class test31 {
public static void main(String[] args){
Xc43 xc43=new Xc43();
Thread ccc=new Thread(xc43);
ccc.start();

}
}
class Xc43 implements Runnable {
public void run(){
for (int i=0;i<10;i++){
System.out.println(Thread.currentThread().getName()+""+i);
try{
Thread.sleep(1000);
}catch(Exception e){

}
}
}
}


运行结果会发现间断输出

java96-线程的睡眠_服务器

 

举报

相关推荐

0 条评论