So is the main method the primary thread that springs in to action when we type in java filename in the command prompt.
Is it a thread that does not to be invoked in the conventional manner.
As in Mythread t1=new Mythread();
The thread that does not need to be elaborated on?
Also, I was curious; what convention does one follow to specify the prioity level of a thread in general.
What exactly does 5 mean, "the most important thread" or " the least important one".
When you run Java class, the JVM looks for the "main()" method and creates a thread for it (called main thread). It assign a stack and all the consequent threds ar children of this main thread call stack.
Varun Goenka wrote:
the JVM "makes" a "main thread" out of the main method written by us?
Yes, we need someone to start, and that someone is JVM which creates a non demon main thread for you so that you can execute your code, by executing "main()" method. Now, How JVM do that, is beyond my knowledge, I don't have a code of JVM .exe file
Joined: Mar 09, 2009
So we can like,use the sleep method, pointlessly, just for fun even though we arent using any thread.
Make things work slowly to "corroborate" the fact that java is slow?
Look, Thread#sleep() and Why Java is Slow is two different questions, they are not related to each other. You can transfer running thread to sleep state by using sleep() method, and the same thing is true about main thread and that' doesn't make Java slow