From ad628fdc2ac0676982d9e3973a8a87d8ee80821e Mon Sep 17 00:00:00 2001 From: chenlw <874313221@qq.com> Date: Wed, 7 Dec 2016 09:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/com/platform/test/MyTestThread.java | 22 ++++++++++++++++++++++ test/com/platform/test/testThread.java | 12 ++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 test/com/platform/test/MyTestThread.java create mode 100644 test/com/platform/test/testThread.java diff --git a/test/com/platform/test/MyTestThread.java b/test/com/platform/test/MyTestThread.java new file mode 100644 index 00000000..82e240c4 --- /dev/null +++ b/test/com/platform/test/MyTestThread.java @@ -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(); + } + } + } +} diff --git a/test/com/platform/test/testThread.java b/test/com/platform/test/testThread.java new file mode 100644 index 00000000..28322553 --- /dev/null +++ b/test/com/platform/test/testThread.java @@ -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()); + } + +}