Runnableスレッド
3703 ワード
/**
* :
* 1、 : Runnable+ run
* 2、 : +Thread + start
*
* : ,
*
*
*/
public class StartRun implements Runnable{
/**
*
*/
@Override
public void run() {
for(int i=0;i<20;i++) {
System.out.println(" ");
}
}
public static void main(String[] args) {
/*//
StartRun sr =new StartRun();
//
Thread t =new Thread(sr);
//
t.start(); // cpu
*/
new Thread(new StartRun()).start();
//st.run(); //
for(int i=0;i<20;i++) {
System.out.println(" coding");
}
}
}