| | |
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 |
-xlint actionlistener android api applet application array automation bi binary blackberry block bluetooth character class client code compile compiler component consumer database desktop developmenthelp eclipse error fractal freeze ftp functiontesting game gameprogramming givemetehcodez graphics gui health html hyper ide image int j2me j2seprojects java javac javaee javaprojects jetbrains jni jpanel jtable julia learningresources lego linked linux mac main map method mobile myregfun netbeans nonstatic notdisplaying number online pearl printf problem program project qt researchinmotion rotatetext rsa scanner screen server set singleton sms sort spamblocker sql string swing system textfields thread threads time title tree tutorial-sample update variablebinding windows working xor






