Thread Cheatsheet

  • Thread can be created by extending Thread Class and overriding the run() method.
  • Thread can also be created by Implementing Runnable interface and then calling Thread constructor that takes Runnnable argument.
  • start() method can be called on Thread Object only once.
  • Once start() method is called on Thread Object it becomes thread of execution. Before start() method called it is said to be in new state and is not considered alive.
  • There is no guarantee of order in which Thread will get executed after getting started.
  • We can influence the order in which Thread get executed by setting its(Thread) priority(1-10).
  • A running thread may enter blocked/waiting state by wait(), sleep or join() call.
  • A runnning thread may enter blocked/waiting state because it can’t acquire the lock of a synchronized block of code.
  • A dead thread can not be started again.

1 Comment Thread Cheatsheet

Leave A Comment

Your email address will not be published. Required fields are marked *