My understanding is that threads in theory are executed in parallel. JVM decides; when a resource is available which thread to pick from the waiting thread queue (based on some
Don't use threads, is the straightforward answer.
If you don't want code to run out of order, then why are you using threads at all? Just execute things step by step like normal.
If you want certain parts of the threads to run in order, then use standard concurrency mechanisms like locks, wait/notify, and semaphores, but if you just want whole operations to run in a specific order, then...run them in order. Without threads.