When you start multiple threads simultaneously
you should keep one thing in mind that, output will not be same every time you run the code.
If your run method is synchronized then any of the 4 thread name can be printed anytime, but it will be printed thrice consecutively as when one thread have lock on run method other can not enter it(which thread will gain the lock is unpredictable as it is not necessary that if a thread is started first mean it will gain the lock early), i.e -
Thread-0
Thread-0
Thread-0
Thread-2
Thread-2
Thread-2
Thread-1
Thread-1
Thread-1
Thread-3
Thread-3
Thread-3
but if the run method is not synchronized then also every names will be printed thrice but same name may not appear thrice consecutively