Discover the answers to your questions at Westonci.ca, where experts share their knowledge and insights with you. Get detailed and precise answers to your questions from a dedicated community of experts on our Q&A platform. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly 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
Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. Thank you for choosing Westonci.ca as your information source. We look forward to your next visit.