I am printing information to test Threads using Reentrant locks. I am creating fair locks using statement new ReentrantLock(true).
In one of the object method where I a
Although it is hard to answer this question without seeing the code starting the threads, this does not seem to have anything to do with the behavior of System.out.printf(). The threads you are starting are waking up and sleeping independently from each other, so the order of the lines printed among the threads is dependent on the JVM running the code. If you need the statements in order, but you want to do the work in parallel, a CyclicBarrier could be used to coordinate the print statements.