In this program, we have created the two static methods: thread1() and thread2() in the ParallelThread class. In the main method, we have created the object of Thread class and passed the thread1 and thread2 methods in ThreadStart delegate with classname.methodname. Then, we used Thread.Sleep() method to suspends the current thread for the specified amount of time. At the end, we called Start() method of Thread class with t1 and t2 objects accordingly. The output clearly shows the two thread worked simultaneously.
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.