First of all, just ignore static in this code:
static Object lock1 = new Object(); because it is confusing you more than helping you.
static methods when they are synchronized then they are locked on the class.
Ok, think about it this way. When you lock on the object then only the thread with the lock to that object can access the synchronized methods or block with in that object, but other threads can access NON synchronized blocks or methods at the same time since they don't need lock for those blocks or methods.
# void doIt(){
# synchronized(lock1){ System.out.print(Thread.currentThread().getName()); i1++; }
# j1++;
So by going back to the original code as the snipe shows above, note that
i1++ is in the synchronized block while
j1++ is outside the synchronized block. This mean that when (or even before)
first thread is incrementing i1++ in the synchronized block
second thread can be incrementing j1++. This is what that program is trying to show, some concurrency involving 2 threads inside and outside synchronized blocks.
Cheers!!!