Can someone help me with it?I want all my operations to be performed simultaneously. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone help me with it?I want all my operations to be performed simultaneously.

https://code.sololearn.com/cGGmk6q6F02B/?ref=app

6th Nov 2019, 1:39 AM
Rithika Baskaran
Rithika Baskaran - avatar
3 Answers
0
So what you are trying to do is that you have created three classes addition, subtraction and multiplication. You are creating a matrix in the main method and then you are passing it to the constructor of each class. Then you have also extended the Thread class and inside the run method you declare a variable and get the user input for that and add, subtract, and multiply it with the matrix you created. And you want all operations to show output simultaneously?
6th Nov 2019, 4:53 AM
Avinesh
Avinesh - avatar
0
Yes but I am not getting the answer.
6th Nov 2019, 10:19 AM
Rithika Baskaran
Rithika Baskaran - avatar
0
Why don't you less complicate it and initialize the values to the array by yourself and then try it. Also I think you need to call the start() on the reference variable of the class that you have defined in the main(). Also you need to use sleep(). You should use the synchronize keyword in the methods you defined because it provides thread safety and an operation is given enough time by the processor to complete it's task.
6th Nov 2019, 10:25 AM
Avinesh
Avinesh - avatar