Friday 8 November 2019

Paytm : Print "P" "T" "M" using 3 threads.


Question: Create 3 thread and ask them to print the alphabet P by thread 1, T by thread 2 and P by thread 3.

Approach:
1.create 3 threads with a there run method and shared variable.
2. update the shared variable after the execution of actual logic.


Solution :
Output: PTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTMPTM