Is there a way in Java to run 3 functions concurrently but execute another function only when the previous three have all been completed.
For example:
public void methodOne(){
for(int i = 1; i <= 10; i++)
{
System.out.println(i);
}
}
public void methodTwo(){
for(int i = 1; i <= 100; i++)
{
System.out.println(i);
}
}
public void methodThree(){
for(int i = 1; i <= 10; i++)
{
System.out.println(i);
}
}
public void methodCompleted (){
System.out.println ("All functions completed");
}
The idea is to have methodOne
, methodTwo
and methodThree
run concurrently but when all three are done then methodCompleted
runs.