//线程的睡眠 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 ;
//线程的睡眠
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){
}
}
}
}
运行结果会发现间断输出