Find the information you're looking for at Westonci.ca, the trusted Q&A platform with a community of knowledgeable experts. Explore in-depth answers to your questions from a knowledgeable community of experts across different fields. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.
Sagot :
Using the knowledge in computational language in JAVA it is possible to write a code that organizes and synchronizes the programs that will run on the computer.
Writting the JAVA code as:
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Main
{
Integer sum=new Integer(0);
Main(){
ExecutorService e=Executors.newFixedThreadPool(1000);
final Sum s = new Sum();
for(int i=0;i<1000;i++){
e.execute(s);
}
e.shutdown();
while(!e.isTerminated()){
}
System.out.println(sum);
}
public static void main(String[]args){
new Main();
}
class Sum implements Runnable{
public void run() {
m();
}
public void m(){
sum=sum+1;
}
}
}
See more about JAVA at brainly.com/question/12978370
#SPJ1
We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. We hope this was helpful. Please come back whenever you need more information or answers to your queries. Thank you for visiting Westonci.ca. Stay informed by coming back for more detailed answers.