CSE21P8 - Object Oriented Programming - I Lab¶
Multithreading¶
Term 171¶
Exp 7. Suppose you have three tasks or threads such as Task1, Task2 and Task3 respectively. Every task pick a random sleep time between 0 and 20 seconds and go to sleep for that time and display for that time. In the mean time another task are trying to complete their task. After completed sleep time of every task, the output gives the message that "Tasks are done sleeping". This is multitasking/multithreading problem. Now write a Java multithreading program to solve this problem.
Term 211¶
Exp 04. Write a Java program that implements a multi-thread application that has three threads. First thread generates a random integer every 1 second and if the value is even, second thread computes the square of the number and prints. If the value is odd, the third thread will print the value of the cube of the number.