Run() priority order | Sololearn: Learn to code for FREE!

0

Run() priority order

Hi ! I made a program in which two classes inherted Thread class and then i made the objects for both these classes and ran the program. The output for the later created obj came first and the output for the first one came out last . So is there any reason behind this ?

6/1/2017 7:43:33 PM

Pranav Raizada

1 Answer

New Answer

+1

By default, every thread you create has same priority(of 5). Since they run in parallel, randomly any one of them can be executed first, even if you run 5 threads or more.