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 13:00
Which option should u select to ignore all tracked changes in a document
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Acase study allows a more detailed look at the life of a single subject than any other study.
Answers: 3
question
Computers and Technology, 24.06.2019 00:20
The guy wire bd exerts on the telephone pole ac a force p directed along bd. knowing the p must have a 720-n component perpendicular to the pole ac, determine the magnitude of force p and its component along line ac.
Answers: 2
question
Computers and Technology, 24.06.2019 01:30
How can you make your column headings stand out?
Answers: 1
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, 25.03.2020 05:07
Questions on the website: 13722362