Results 1 to 4 of 4
  1. #1
    Manuv16589 is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default Use of join() method

    Hi members,
    I am a new learner of java. There is a code in my book. I cant write the whole code. I am specifying only 'try' part of it.
    Try{
    ob1.t.join();
    ob2.t.join();
    ob3.t.join();
    }
    though try has no loop after if i am right so when main thread is interrupted by first join method ob1 starts then ob2 and then ob3 and again ob1. How it is possible. Plz help.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,559
    Rep Power
    25

    Default Re: Use of join() method

    If you are a beginner with java, you should wait some time before trying to master threads.
    There are no requirements for loops when using a thread.
    Have you read the API doc for the join() method?
    There is nothing said there about starting a thread.

    In the code you posted, ob1 is not a method. It looks like a variable.

    If you have a program that you don't understand, post the whole program, not just 5 lines of code.

  3. #3
    Manuv16589 is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default Re: Use of join() method

    Ok thanks for reply. Can anybody explain how actually join works inside try

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,559
    Rep Power
    25

    Default Re: Use of join() method

    Did you read the API doc ? What did it say?
    Post the code for a full program that uses join() if you need help getting it to work.

    Otherwise this does not look like a programming problem.

Similar Threads

  1. SQL JOIN / UNION not sure what to do
    By Dcalladi in forum New To Java
    Replies: 1
    Last Post: 02-24-2012, 04:16 AM
  2. wiat() vs join()
    By jomypgeorge in forum New To Java
    Replies: 4
    Last Post: 01-21-2011, 07:43 AM
  3. Error in the "join" method of StringUtils
    By shihad_s in forum New To Java
    Replies: 3
    Last Post: 12-14-2010, 09:01 AM
  4. Regarding Join
    By adeeb in forum JDBC
    Replies: 1
    Last Post: 06-24-2008, 07:57 PM
  5. How to use join() method
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 06:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •