0% found this document useful (0 votes)
2 views1 page

Java Thread Methods

This document outlines key Java thread methods, including start(), run(), sleep(), and join(), which manage thread execution and behavior. It also mentions methods for thread naming, checking status, and priority management, as well as deprecated methods that should not be used. Overall, it serves as a comprehensive guide to essential Java threading operations.

Uploaded by

nitinkumarf85
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Java Thread Methods

This document outlines key Java thread methods, including start(), run(), sleep(), and join(), which manage thread execution and behavior. It also mentions methods for thread naming, checking status, and priority management, as well as deprecated methods that should not be used. Overall, it serves as a comprehensive guide to essential Java threading operations.

Uploaded by

nitinkumarf85
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Thread Methods - Complete Notes

1. start() - Starts a new thread and internally calls run().

2. run() - Contains the code executed by the thread.

3. sleep(ms) - Pauses execution for given milliseconds.

4. join() - Waits for another thread to finish.

5. getName()/setName() - Gets or sets thread name.

6. currentThread() - Returns currently executing thread.

7. isAlive() - Checks if thread is still running.

8. yield() - Gives chance to other threads to execute.

9. setPriority()/getPriority() - Sets thread priority (1 to 10).

10. interrupt() - Interrupts a sleeping or waiting thread.

11. isInterrupted() - Checks interruption status.

Deprecated Methods (Do Not Use):

stop(), suspend(), resume() - unsafe and removed due to issues.

You might also like