Discover the answers to your questions at Westonci.ca, where experts share their knowledge and insights with you. Experience the ease of finding accurate answers to your questions from a knowledgeable community of professionals. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.
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
Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Discover more at Westonci.ca. Return for the latest expert answers and updates on various topics.