Interviews - C# Corner

Kamal Pal
Write A program To Print "INDIA" "CHINA" "INDIA",CHINA using Two Threads in C#
By Kamal Pal in ASP.NET onAug 22 2012
  • Arman Kumar
    Aug, 2013 25

    using System; using System.Collections.Generic; using System.Text;\using System.Threading.Tasks; using System.Threading; namespace Print_Message {class Program{public void firstMessage(){for (int i = 0; i < 2; i++) {Console.WriteLine("INDIA");Thread.Sleep(1000);}}public void secondMessage(){for (int j = 0; j < 2; j++){Console.WriteLine("CHINA");Thread.Sleep(1000);}}static void Main(string[] args){Program prg = new Program();ThreadStart thread_start1 = new ThreadStart(prg.firstMessage);Thread thread1 = new Thread(thread_start1);thread1.Start();Thread.Sleep(500);ThreadStart thraed_start2 = new ThreadStart(prg.secondMessage);Thread thread2 = new Thread(thraed_start2); thread2.Start(); Console.ReadLine();}} }

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS