I am learning about Thread in Java. I was tring to fetch which thread is running. But, I am not able to understand the order of the output.
Following is
First .. please format your code for better visibility.Then use java naming convention.To find them out look here. It seems that you are a beginner in Threads and not understanding them in the first glance is completely OK.The unexpected order is related to OS scheduling and the concept of executing instructions and not methods concurrently, this mean that concurrent execution does not mean that run method will run concurrently, that means that everything (every instruction) in that method can/will run concurrently. Just keep learning Threads are (maybe) the most difficult area of Java but also the most interesting.