After knowing how to create and run threads and heavy and light weight threads, it is the time to prioritize threads.
A thread in Java can be given a priority within the range from 1 to 10. If no priority is given, the thread takes a default priority of 5. Two methods exist in Thread class to give and retrieve the priority of a thread – setPriority() and getPriority().
The following program illustrates on thread priorities. To differentiate the threads, setName() and getName() are also used to set a name to a thread and retrieve the name of a thread.
For all programs on multithreading
It’s very simple to find oout any topic on web as compared to books, as I found this piece of writing at this web page.