This commit is contained in:
parent
9dd1b0f019
commit
ad628fdc2a
|
@ -0,0 +1,22 @@
|
|||
|
||||
package com.platform.test;
|
||||
|
||||
public class MyTestThread extends Thread{
|
||||
|
||||
public MyTestThread() {
|
||||
this.setDaemon(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
System.out.println(i);
|
||||
try {
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.platform.test;
|
||||
|
||||
|
||||
public class testThread {
|
||||
|
||||
public static void main(String[] args) {
|
||||
MyTestThread thj = new MyTestThread();
|
||||
thj.start();
|
||||
System.err.println(thj.isDaemon());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue