Hi, Why I am getting Runtime Exception as given below.
Stephan van Hulst
posted 5 years ago
You are getting a runtime exception because you can start the thread only once. You are starting the same thread, because the getInst() method returns the same (static) Thread, regardless of what object you call it on.
The reason you are getting a stack overflow error, is because if you remove the static modifier, when the tr member is initialized, that new member will also initialize it's internal tr reference, which in turn will initialize it's initial reference, etc, etc, ad infinitum.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.