Important Things You Need to Remember About Thread in Java

threadstate_trans

  • There are 2 ways to create thread. By implements Runnable or extends Thread class. Then, override run method.
  • To make a move of thread, just call thread.start() . NOT the run() method directly.
  • Thread will die if run() process completed execute.
  • There are some methods that you can use to manage your application for concurrency:
    • setPriority(). Each OS has numerous number of the priority.
    • join()
    • synchronized
    • yield()
    • interrupt()
    • sleep()

2 thoughts on “Important Things You Need to Remember About Thread in Java

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s