This piece of code will not compile:
synchronized( obj ) {
Object a = new Object()
}
System.out.println( a.toString() );
Yet I don't know why.. My understanding was that a synchronized block was always eventually executed, so I would expect code following the synchronized block to be aware of any new declared variables. Where am I wrong?