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

Posted on 2004-11-21
Last Modified: 2006-11-17
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.

Question by:chaitu chaitu
    LVL 2

    Expert Comment

    Join blocks the current thread until the thread you issued the join on dies.
    LVL 3

    Accepted Solution

    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)



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    Title # Comments Views Activity
    zeroMAx challenge 20 66
    sumHeights  challenge 17 50
    triangle challenge 4 35
    countHi challenge 25 59
    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now