随笔分类 - Thread
摘要:package Thread1; /** * 主方法 * * @author zhangyugeng * 创建汽车类Car 创建汽车工厂类CarFactory 创建顾客类Client */ public class CreateAndBuyCar { public static void main(String[] args) { Car car = ...
阅读全文
摘要:import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.TimeUnit; public class ThreadDemo5 { pub
阅读全文
摘要:public class ThreadDemo4 { static ShareData data=new ShareData(); public static void main(String[] args) { new Thread(new Myrunnable1(data)).start();
阅读全文
摘要:import java.util.Random; public class ThreadDemo3 { public static void main(String[] args) { for(int i=0;i<2;i++){ //两个线程 new Thread(new Runnable() {
阅读全文
摘要:import java.util.HashMap;import java.util.Map;import java.util.Random; public class ThreadDemo2 { static int data = 0; //定义一个数据 static Map<Thread, Int
阅读全文
摘要:A thread is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurren
阅读全文

浙公网安备 33010602011771号