Question: Why is it that two synchronized blocks can't be executed simultaneously by two different threads in Java.

**EDIT**

```
public class JavaApplication4 {

    public static void main(String[] args) {
        new JavaApplication4();
    }

    public JavaApplication4() {
        Thread t1 = new Thread() {

            @Override
            public void run() {
                if (Thread.currentThread().getName().equals("Thread-1")) {
                    test(Thread.currentThread().getName());
                } else {
                    test1(Thread.currentThread().getName());
                }
            }
        };
        Thread t2 = new Thread(t1);
        t2.start();
        t1.start();

    }

    public synchronized void test(String msg) {
        for (int i = 0; i < 10; i++) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException ex) {
            }
            System.out.println(msg);
        }
    }

    public synchronized void test1(String msg) {
        for (int i = 0; i < 10; i++) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException ex) {
            }
            System.out.println(msg + " from test1");
        }
    }
}

```

Answer: 
Your statement is false. Any number of synchronized blocks can execute in parallel as long as they don't contend for the same lock.

But if your question is about blocks contending for the same lock, then it is wrong to ask "why is it so" because that is the purpose of the whole concept. Programmers **need** a mutual exclusion mechanism and they get it from Java through `synchronized`.

Finally, you may be asking "Why would we ever need to mutually exclude code segments from executing in parallel". The answer to that would be that there are many data structures that only make sense when they are organized in a certain way and when a thread updates the structure, it necessarily does it part by part, so the structure is in a "broken" state while it's doing the update. If another thread were to come along at that point and try to read the structure, or even worse, update it on its own, the whole thing would fall apart.

EDIT
====

I saw your example and your comments and now it's obvious what is troubling you: the semantics of the `synchronized` modifier of a method. That means that the method will contend for a lock on `this`'s monitor. All `synchronized` methods of the same object will contend for the same lock.
Two Threads can execute synchronized blocks simultaneously till the point they are not locking the same object.

In case the blocks are synchronized on different object... they can execute simultaneously.

```
synchronized(object1){
    ...
}

synchronized(object2){
    ...
}

```

**EDIT:**
`Please reason the output for http://pastebin.com/tcJT009i`

**In your example when you are invoking synchronized methods the lock is acquired over the same object. Try creating two objects and see.**