Top Posters
Since Sunday
L
4
d
4
3
k
3
k
3
j
3
k
3
b
3
f
3
b
3
d
3
h
3
New Topic  
Crystalboo92 Crystalboo92
wrote...
Posts: 545
4 years ago
Suppose there are three Runnable tasks, task1, task2, task3. How do you run them in a thread pool with 2 fixed threads?

▸ ExecutorService executor = Executors.newFixedThreadPool(1); executor.execute(task1); executor.execute(task2); executor.execute(task3);

▸ ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(task1); executor.execute(task2); executor.execute(task3);

▸ ExecutorService executor = Executors.newFixedThreadPool(3); executor.execute(task1); executor.execute(task2); executor.execute(task3);

▸ new Thread(task1).start(); new Thread(task2).start(); new Thread(task3).start();
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 32 times
1 Reply
Replies
Answer verified by a subject expert
jrhome1985!jrhome1985!
wrote...
Posts: 375
4 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here
1

Related Topics

Crystalboo92 Author
wrote...

4 years ago
This site is awesome
wrote...

Yesterday
I appreciate what you did here, answered it right Smiling Face with Open Mouth
wrote...

2 hours ago
Thanks
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  978 People Browsing
Related Images
  
 187
  
 4574
  
 260
Your Opinion
How often do you eat-out per week?
Votes: 80