can someone please explain me this program the output is
Done but it is being printed only once
it should b printing Done twice
its not my program this was thought in our class today
using System;
using System.Threading;
class ThreadTest
{
bool done;
static void Main()
{
ThreadTest tt = new ThreadTest(); // Create a common instance
new Thread (tt.Go).Start();
tt.Go();
}
// Note that Go is now an instance method
void Go()
{
if (!done) { done = true; Console.WriteLine ("Done"); }
}
}
-