Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5839
  • Last Modified:

what is difference between join() and yield() ?

what is difference between join() and yield() ?

yield() is used when we want to give otherthread of the same priority access to run then we use yield method.

then what is join() method do.

chaitu chaitu
chaitu chaitu
1 Solution
Join blocks the current thread until the thread you issued the join on dies.
The yield() method causes the current thread to move from the running state to the runnable state, so that other threads may get a chance to run. However, the next thread chosen for running might not be a different thread:

  public static void yield()

When a thread calls join() on another thread, the currently running thread will wait until the thread it joins with has completed:

  void join()        
  void join(long millis)
  void join(long millis, int nanos)



Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now