subject

I have a class named Counter. In this class I have a synchronized method called countRange(). This method prints out a count in the range from the minimum to the maximum values stored by the Counter class attributes. Please implement the body of the main() method in Test class to instantiate and start two threads that invoke countRange() method. You can use either named or anonymous Thread instances. Don't forget to make a call to start() method in each thread. What I am asking you to do is similar to what Stopwatch examples in the "Multi-threading and concurrent programming" lecture module showed.
Please only include the code inside the main() method into your answer.
Below is the implementation of Counter class and the shell of the main() method in Test class:
import java. lang.*;
class Counter {
private int min;
private int max;
Counter(int min, int max){
this. min = min;
this. max = max;
}
synchronized public void countRange() {
for(int i = this. min; i <= this. max; i++){
System. out. println(i);
}
}
}
public class Test {
public static void main(String[]args) {
// your implementation goes here
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
What are some ways to use a range name in a formula? check all that apply. in the defined names group, click use in formula, and then select the desired name. begin typing the name in the formula, select a name from the autocomplete list, and use the arrow keys and tab key to enter the name in the formula. begin typing the formula, and then click and drag with the mouse to select the cells to include in the formula. right-click one of the cells in the range. click formula options, and use the dialog box to add the name.
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
For her science class, elaine is creating a presentation on weather in the united states. she wants to make the presentation beautiful and interesting by drawing simple cloud or wave shapes. which is the best way for elaine to draw these shapes?
Answers: 1
question
Computers and Technology, 23.06.2019 01:00
Let r be a robotic arm with a fixed base and seven links. the last joint of r is a prismatic joint, the other ones are revolute joints. give a set of parameters that determines a placement of r. what is the dimension of the configuration space resulting from your choice of parameters?
Answers: 3
question
Computers and Technology, 23.06.2019 06:40
What are the three uses of a screw?
Answers: 2
You know the right answer?
I have a class named Counter. In this class I have a synchronized method called countRange(). This m...
Questions
question
Mathematics, 12.10.2020 23:01
question
Mathematics, 12.10.2020 23:01
Questions on the website: 13722360