Question: In this lab, you will be working with Threads. 1 . ) Write an Application that extends the Thread class, call it MyThread.java. Have your

In this lab, you will be working with Threads.
1.) Write an Application that extends the Thread class, call it MyThread.java. Have your new class accept an integer(i.e.200) when it is instantiated. (MyThread mt= new MyThread(200) This integer number will be the number of times that this class loops and prints a message. The message should read "Thread Running... 200. The 200 would be whatever number is passed into the constructor. If the number was 300, then the output should read c6 Thread Running .....300". Use a main method to test this class. In the main start 2 Threads, one Thread with 250 and one Thread with 300. What happens? You do not need to use the sleep 0 method for this exercise.
2.) Create a new class that does the same as Part 1 above, except use the Rumable Interface instead of the Thread class. Make the name of the class MyRumnablejava, The Constructor and the run methods should be the same as in Part 1. Any difierence in how the code runs?
3.) Lastly, have the main method start 4 different threads, all with dffierent loop counts. Test the application, what happens?
 In this lab, you will be working with Threads. 1.) Write

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 Databases Questions!