Question: TODO: Fill in the blanks in the provided Java classes to complete the following exercise: Write a class that extends thread. The class should take

TODO: Fill in the blanks in the provided Java classes to complete the following exercise:
Write a class that extends thread. The class should take as input an integer to start counting from and a String to use as a name. The run method of the threaded class should print out all the integers from start to 10,000 alongside the thread's name (given as a string input in the constructor).
Main should create two of these threads with different names and start up both of them.
Challenge: see if you can start each thread with a value that makes them finish close to the same time.
The thread you start first is likely to finish before the other thread.
using This code
public class Main
{
public static void main(String args[])
{
//Create new instances of ThreadDemo:
ThreadDemo T1=___________
ThreadDemo T2=___________
//Start up both ThreadDemo objects:
T1___________;
T2___________;
//Wait on the threads to finish.
try{
T1___________;
T2___________;
}catch(InterruptedException e){
System.out.println("Interrupted");
}
System.out.println("
FINISHED
");
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!