On Line Java Training Threads in Java Threads Lecturer 15
Multitasking Allows several activities (two or more process) concurrently on the computer. Java support for multithreading. We can define multithreading as execution of more then one threads same time. Thread Thread is a smallest unit statement which is currently being executed by C.P.U. We can say a thread is a line of execution. It is the smallest unit of code that is dispatched by the scheduler. Common Thread Methods 1. getName() Return the name of the thread. 2. setName() set the name of the thread. 3. getPriority() return the currently priority of the thread. 4. wait() Make a thread in the waiting state. 5. start() start a new thread. 6. sleep() stop working of a thread for specify time. 7. isAlive() return true thread is not finished otherwise false. 8. join() wait for a thread to be finished. 9. current() return the object of currently running thread.
Multitasking Allows several activities (two or more process) concurrently on the computer. Java support for multithreading. We can define multithreading as execution of more then one threads same time. Thread Thread is a smallest unit statement which is currently being executed by C.P.U. We can say a thread is a line of execution. It is the smallest unit of code that is dispatched by the scheduler. Common Thread Methods 1. getName() Return the name of the thread. 2. setName() set the name of the thread. 3. getPriority() return the currently priority of the thread. 4. wait() Make a thread in the waiting state. 5. start() start a new thread. 6. sleep() stop working of a thread for specify time. 7. isAlive() return true thread is not finished otherwise false. 8. join() wait for a thread to be finished. 9. current() return the object of currently running thread.