假设有三个可运行任务,task1,task2,task3。如何在具有2个固定线程的线程池中运行它们? A: newThread(task1).start();newThread(task2).start();newThread(task3).start(); B: ExecutorServiceexecutor=Executors.newFixedThreadPool(3);executor.execute(task1);executor.execute(task2);executor.execute(task3); C: ExecutorServiceexecutor=Executors.newFixedThreadPool(2);executor.execute(task1);executor.execute(task2);executor.execute(task3); D: ExecutorServiceexecutor=Executors.newFixedThreadPool(1);executor.execute(task1);executor.execute(task2);executor.execute(task3);
假设有三个可运行任务,task1,task2,task3。如何在具有2个固定线程的线程池中运行它们? A: newThread(task1).start();newThread(task2).start();newThread(task3).start(); B: ExecutorServiceexecutor=Executors.newFixedThreadPool(3);executor.execute(task1);executor.execute(task2);executor.execute(task3); C: ExecutorServiceexecutor=Executors.newFixedThreadPool(2);executor.execute(task1);executor.execute(task2);executor.execute(task3); D: ExecutorServiceexecutor=Executors.newFixedThreadPool(1);executor.execute(task1);executor.execute(task2);executor.execute(task3);
下列是实现多线程编程的接口为? A: Thread B: Sleep C: Runnable D: Executors
下列是实现多线程编程的接口为? A: Thread B: Sleep C: Runnable D: Executors
1