Why is volatile keyword not allowed for local variables?

Local variables live on the stack; and of course, when you invoke the same method twice, they have all their local variables on their individual stacks.

volatile only makes sense when multiple threads would be writing to the same memory location (on the heap).

Which makes absolutely no sense for local variables from within the body of a method!


And final guarantees initialization safety.

Not on local variables: it just stops you reassigning that variable.

final CountDownLatch latch = new CountDownLatch(3);

Does the above code will guarantee initialization so that latch is perfectly visible to the code below i.e

No. It's this code that guarantees it:

public static class ProcessThread implements Runnable {

    final CountDownLatch latch;

    // Plus the assignment in the constructor.

}

final fields are guaranteed to be visible once the constructor completes (normally). From JLS Sec 17.5:

An object is considered to be completely initialized when its constructor finishes. A thread that can only see a reference to an object after that object has been completely initialized is guaranteed to see the correctly initialized values for that object's final fields.