// Public class testthreadExtends thread{
Public class testthreadImplements runnable{
// Private Static object lock = new object ();
@ Suppresswarnings ("static-access ")
Public void run (){
System. Out. println ("New thread is running ");
// Synchronized (LOCK ){
Synchronized (thread. currentthread ()){
Try {
System. Out. println ("the thread is waiting ");
// Lock. Wait ();
// Thread. currentthread (). Sleep (400 );
Thread. currentthread (). Wait (400 );
System. Out. println ("the thread is unwait ");
} Catch (interruptedexception e ){
E. printstacktrace ();
}
}
}
@ Suppresswarnings ("static-access ")
Public static void main (string [] ARGs ){
// Testthread T1 = new testthread ();
Thread T1 = new thread (New testthread ());
Try {
T1.start ();
System. Out. println ("Main is running ");
System. Out. println ("Main is sleeping ");
Thread. currentthread (). Sleep (500 );
System. Out. println ("Main is unsleep ");
// Synchronized (LOCK ){
// Lock. policyall ();
//}
Synchronized (thread. currentthread ()){
Thread. currentthread (). policyall ();
}
} Catch (interruptedexception e ){
E. printstacktrace ();
}
}
}