TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Tuesday 28 April 2020

Thread Join Method In Java | Java Thread Join Multiple Threads | Thread Join Method In Hindi

                             Thread Join() method

The join() method waits for a thread to die. In other words, it causes the currently running threads to stop executing until the thread it joins with completes its task.

java thread join multiple threads

Fig: Join () Method 

Syntax:

public void join()throws InterruptedException
public void join(long milliseconds)throws InterruptedException

  

   Example of join() method 

   class TestJoinMethod1 extends Thread{  
    public void run(){  
     for(int i=1;i<=5;i++){  
    try{  
    Thread.sleep(500);  
    } 
    catch(Exception e){System.out.println(e);}  
     System.out.println(i);  
    }  
      } 

No comments:

Post a Comment