Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Example on how to use Join()  RSS feed

 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class demo
{
public static void main(String[] args)
{
xclass x=new xclass();
Thread thread2=new Thread(x);
thread2.start();
try{
thread2.join();// current thread will wait till run of thread2 is over
}
catch(Exception e){}
System.out.println("Done");
}
}
class xclass implements Runnable
{public void run(){
int i;
for (i=0;i<10000 ;i++ )
{System.out.println(i);
}
}}
Regds.
Rahul.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!