Top Posters
Since Sunday
1
1
l
1
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 29 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 is exactly what I needed
wrote...

Yesterday
Helped a lot
wrote...

2 hours ago
Good timing, thanks!
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  857 People Browsing
Related Images
  
 4456
  
 258
  
 192
Your Opinion
How often do you eat-out per week?
Votes: 80