187
1301
1948
通神3段 Lv.6
使用道具 举报
531
1325
2056
萨菲尔斯
397
2280
3045
通神5段 Lv.8
451
124
1008
z895057655 发表于 2014-3-7 12:03 同求 网上很少这样的系列教程
package test; import java.util.Vector; import java.util.Date; /** * 线程测试实例 * @author 静止的流水 * */ public class Threadnew { /** * * @author 静止的流水 * */ class ThreadA extends Thread { private Date runtime; public void run() { System.out.println("ThreadA begin."); this.runtime = new Date(); System.out.println("ThreadA end."); } } /** * * @author 静止的流水 * */ class ThreadB implements Runnable { private Date runtime; public void run() { System.out.println("ThreadB begin."); this.runtime = new Date(); System.out.println("ThreadB end."); } } /** * * */ public void starta() { Thread threada = new ThreadA(); threada.start(); } /** * * */ public void startb() { Runnable threadb = new ThreadB(); Thread thread = new Thread(threadb); thread.start(); } /** * * @param args */ public static void main(String[] args) { Threadnew test = new Threadnew(); test.starta(); test.startb(); } }
477
1537
3190
bai度 发表于 2014-3-7 15:00 Java多线程实现简单实例 定义和启动线程主要有两个关键技术: 第一:线程类必须实现java.lang.Runnable ...
280
-10
190
凡人2阶 Lv.2
本版积分规则 发表回复 回帖并转播 回帖后跳转到最后一页
它象征着你在苍海的荣耀 绑定百度账号自动发放
小黑屋|苍海国际 ( 鲁ICP备13020644号-1 )
GMT+8, 2025-2-22 23:45 , Processed in 0.051801 second(s), 23 queries .
Powered by Discuz! Theme By eRic Modified by 4bpa
© CangHai International We Do Our Rights!