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, 23.06.2019 03:50
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria.what am i?
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
To check whether your writing is clear , you can
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
Which two technologies support the building of single-page applications?
Answers: 2
question
Computers and Technology, 24.06.2019 22:30
The a great imaginary circle, or reference line, around earth that is equally distant from the two poles and divides earth into the northern and southern hemispheres.
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, 03.05.2020 14:14
question
Mathematics, 03.05.2020 14:14
question
Mathematics, 03.05.2020 14:14
question
Mathematics, 03.05.2020 14:14
Questions on the website: 13722360