- 10
- 0
- 约6.47万字
- 约 14页
- 2016-12-27 发布于贵州
- 举报
—高级软件人才实作培训专家! * 1.启动线程的代码和下面启动定时器的代码一起放在一个名叫TraditionalThread的类中: 方式1: new Thread(){ public void run(){ while(true){ try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName()); } } }.start(); 方式2: new Thread(new Runnable(){ public void run(){ while(true){ try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName()); } } }).star
原创力文档

文档评论(0)