Answer:
Following are the code to this question:
Counter T = new Counter(1, 100); //creating Counter class object and call its parameterized constructor
Thread T1 = new Thread(new Runnable() //creating Thread object T1.
{
public void run() //define run method
{
T.countRange(); //call countRange method
}
});
Thread T2 = new Thread(new Runnable() //creating another object "T2" of Thread.
{
public void run() //define run method
{
T.countRange(); //call countRange method
}
});
T1.start(); //start Thread T1
T2.start(); //start Thread T2
Explanation:
Description of the above code as follows: