| | |
threads urgent
![]() |
Your class must extend the Thread class and implement the run method. (void run())
When your class runs that method it is executed in parallel with any other thread, included the main(String [] args).
So just create a class that stores the random numbers in an array. Code must go in the run().
Call two instances of this class. When you call their run() methods they will be executed in parallel.
When they are done use a second class to take those arrays and do the sorting.
Don't forget to have a boolean to check when they are both(the classes the generated the numbers) done because if you call the second class for the sorting right after the threads then it will be executed without the generation of the random number being finished.
When your class runs that method it is executed in parallel with any other thread, included the main(String [] args).
So just create a class that stores the random numbers in an array. Code must go in the run().
Call two instances of this class. When you call their run() methods they will be executed in parallel.
When they are done use a second class to take those arrays and do the sorting.
Don't forget to have a boolean to check when they are both(the classes the generated the numbers) done because if you call the second class for the sorting right after the threads then it will be executed without the generation of the random number being finished.
Check out my New Bike at my Public Profile at the "About Me" tab
![]() |
Similar Threads
- Urgent, please help (Viruses, Spyware and other Nasties)
- please someone help me urgent (C++)
- Super urgent Please help!!! administer (OS X)
- Urgent:need Help (C++)
- urgent..i need help.. (C++)
- Add/Remove Programs List Gone! (Windows 95 / 98 / Me)
- pls heeeeeeeeelp its urgent. (C)
- Urgent! (C++)
Other Threads in the Java Forum
- Previous Thread: identifier
- Next Thread: how to get the name and instance id of an application using java
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary blackberry block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working






