What happens in the following code? Does the synchronization work? This is an interview question.
class T
{
public static void main(String args[])
{
Object myObject = new Object();
synchronized (myObject)
{
myObject = new Object();
} // end sync
}
}