Maybe a stupid question but still ask.

There is a synchronized block in which the object is blocked. In the constructor of this object, another object is created.

Is the question blocked in the same way?

example:

 public class SomeClass{ private SecondClass sClass; public SomeClass(){ sClass = new SecondClass(); } . . // some action . try{ synchronized(this){ this.wait(sometime); } } 
  • No, it is not blocked. - Pavel Mayorov

1 answer 1

Not blocked. On this site there was a question on another topic, but the answer to it can help you:

The object on which you synchronize is in no way connected with the contents of this object. It's just that Java is so strangely arranged that you can use absolutely any object as a synchronization monitor and no matter what kind of object it is and what else it can be used for.