The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
public class SortingExample
Â
{
 public static final int SIZE = 10;
Â
Â
 public static void main(String[] args) {
 Integer[] listOne = {7, 12, 19, 3, 18, 4, 2, 6, 15, 11};
 Integer[] listTwo = {16, 1, 5, 9, 13, 20, 17, 8, 10, 14};
 Object[] finalList = new Object[listOne.length + listTwo.length];
Â
Â
 // create two threads:
 Thread sortingThreadOne = new Thread(new SortingThread(listOne));
 Thread sortingThreadTwo = new Thread(new SortingThread(listTwo));
 sortingThreadOne.start();
 sortingThreadTwo.start();
Â
Â
 try {
 sortingThreadOne.join();
 sortingThreadTwo.join();
 }
 catch (InterruptedException ie) { }
Â
Â
 // now merge the lists into a single list
Â
Â
 Thread mergeThread = new Thread(new MergeThread(listOne, listTwo, finalList));
 mergeThread.start();
 try {
 mergeThread.join();
 }
 catch (InterruptedException ie) { }
Â
Â
 // now print out the list
Â
Â
 for (int i = 0; i < finalList.length; i++)
 System.out.println(finalList[i]);
Â
Â
 }
}
Â
1.Implement the TaskThreadDemo.java thread example.
2.Implement the bounded buffer producer-consumer problem using multithreaded. Modify the producer that the data come from a random number generator.
3.Implement the Socket Communication program using multithreaded so that the server services each client request in a separate thread.
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly