java tutorial - Java thread join - java programming - learn java - java basics - java for beginners
Learn Java - Java tutorial - Java thread join - Java examples - Java programs
The join() method
- The join() methods waits until the thread will die.
- In other word, it will cause the presently running threads to end its executing until the thread joins to complete its task.
Syntax:
join() method
Output
- When time1 is completes its task then time2 and time3 starts executing.
join(long miliseconds) method
Output
- When time1 is completes its task for 1700 milliseconds (3 times) then time2 and time3 starts executing.
getName(),setName(String) and getId() method:
The currentThread() method:
- These method returns a reference to the currently executing thread object.