第六章线程.ppt

第六章线程

Essential Programming with Java / chapter 11 线程 第六章 目标 了解多线程的概念 掌握如何创建线程 了解死锁的概念 掌握线程同步 掌握使用 wait() 和 notify() 在线程之间进行通信 多任务处理 基于线程的多任务处理的优点 多线程 主线程 主线程示例 class Mythread extends Thread { public static void main(String args[]) { Thread t= Thread.currentThread(); System.out.println(当前线程是: +t); t.setName(MyJavaThread); System.out.println(当前线程名是: +t); try { for(int i=0;i3;i++) { System.out.println(i); Thread.sleep(1500); } } catch(InterruptedException e) { System.out.println(主线程被中断); } } } 创建线程 1-1 创建线程 1-2 创建线程示例(1) class MyThread1

文档评论(0)

1亿VIP精品文档

相关文档