Package com;
Public class test implements runnable ...{
Public static void main (string [] ARGs )...{
Test test = new test ();
Thread thread = new thread (test );
Thread. Start ();
System. Out. println (system. currenttimemillis ());
// Try {
// Thread. Sleep (5000 );
//} Catch (interruptedexception e ){
//
// E. printstacktrace ();
//}
// (;;)
...{
System. Out. println (system. currenttimemillis ());
System. Out. println (thread. currentthread (). getname () + "Haha ");
}
}
Public void run ()...{
Try ...{
Thread. Sleep (5000 );
} Catch (interruptedexception e )...{
E. printstacktrace ();
}
// (;;)
...{
System. Out. println (thread. currentthread (). getname () + "Byebye ");
}
}
}
1211852076125
1211852076125
Main haha
Thread-0 Byebye
Package com;
Public class test implements runnable ...{
Public static void main (string [] ARGs )...{
Test test = new test ();
Thread thread = new thread (test );
Thread. Start ();
System. Out. println (system. currenttimemillis ());
Try ...{
Thread. Sleep (5000 );
} Catch (interruptedexception e )...{
E. printstacktrace ();
}
// (;;)
...{
System. Out. println (system. currenttimemillis ());
System. Out. println (thread. currentthread (). getname () + "Haha ");
}
}
Public void run ()...{
// Try {
// Thread. Sleep (5000 );
//} Catch (interruptedexception e ){
//
// E. printstacktrace ();
//}
// (;;)
...{
System. Out. println (thread. currentthread (). getname () + "Byebye ");
}
}
}
1211852205906
Thread-0 Byebye
1211852210906
Main haha
Package com;
Public class test implements runnable ...{
Public static void main (string [] ARGs )...{
Test test = new test ();
Thread thread = new thread (test );
Thread. Start ();
System. Out. println (system. currenttimemillis ());
Try ...{
Thread. Sleep (5000 );
} Catch (interruptedexception e )...{
E. printstacktrace ();
}
// (;;)
...{
System. Out. println (system. currenttimemillis ());
System. Out. println (thread. currentthread (). getname () + "Haha ");
}
}
Public void run ()...{
Try ...{
Thread. Sleep (5000 );
} Catch (interruptedexception e )...{
E. printstacktrace ();
}
// (;;)
...{
System. Out. println (thread. currentthread (). getname () + "Byebye ");
}
}
}
1211852246312
1211852251312
Main haha
Thread-0 Byebye