摘要: 线程实行顺序问题,求教 阅读全文
posted @ 2013-10-15 09:42 平林新袖 阅读(1143) 评论(3) 推荐(0) 编辑
摘要: 1 package MyTest; 2 3 class TestDemo implements Runnable { 4 5 public void run() { 6 int i = 0; 7 for (int j = 0; j " 9 + i++);10 }11 }12 }13 14 public class Demo1 {15 public static void main(String[] args) {16 TestDemo testDemo = n... 阅读全文
posted @ 2013-10-15 09:11 平林新袖 阅读(583) 评论(0) 推荐(0) 编辑
摘要: 前台程序是相对于后台程序来说的,那么什么是后台程序呢? 【后台程序】就是在启动了start()之前,调用了setDaemon(true)方法,这个线程就变成了后台。如果一个进程中只用后台线程在运行,那么整个进程就会结束。package Test;class CTest implements Runnable { public void run() { while(true) System.out.println(Thread.currentThread().getName()+" is running."); }}public class De... 阅读全文
posted @ 2013-10-15 07:16 平林新袖 阅读(171) 评论(0) 推荐(0) 编辑