package
com.Thread;
public
class
Jion_yield {
public
static
void
main(String[] args)
throws
Exception {
Test tes =
new
Test();
Thread t =
new
Thread(tes);
t.start();
for
(
int
i = 0; i<1000; i++) {
// if(i==200) {
//合并线程
// t.join();
// }
if
(i%20==0) {
//暂停本线程
Thread. yield();
}
System.
out
.println(
"main+++++"
+ i);
}
}
}
class
Test
implements
Runnable{
@Override
public
void
run() {
for
(
int
i=0; i<1000; i++) {
System.
out
.println(
"Test...."
+ i);
}
}
}