This commit is contained in:
chenlw 2016-12-07 09:28:47 +08:00
parent 9dd1b0f019
commit ad628fdc2a
2 changed files with 34 additions and 0 deletions

View File

@ -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();
}
}
}
}

View File

@ -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());
}
}