标签:div print cheng int 音乐 线程 gen 背景 art
package xiancheng; public class TestDemo { /** * @param args */ public static void main(String[] args) { T1 t=new T1(); Daemon d=new Daemon(); t.start(); //将d设置成守护线程 d.setDaemon(true); d.start(); } } class T1 extends Thread{ public void run(){ for(int i=0;i<50;i++){ System.out.println(i); try { Thread.sleep(200); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } class Daemon extends Thread{ public void run(){ while (true){ System.out.println("播放背景音乐"); try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); }} } }
标签:div print cheng int 音乐 线程 gen 背景 art
原文地址:http://www.cnblogs.com/zyy1130/p/6849282.html