Yes, new instances of a class can be created while a static synchronized method is executing.
Let’s break it down:
🔒 static synchronized method
- It locks on the
Classobject, not on an instance. - So, if thread A is executing a
static synchronizedmethod, it holds the class-level lock.
💡 Creating new instances
- Creating an object via
new MyClass()does not require any lock. - It’s simply calling a constructor, which is not synchronized by default.
- Therefore, other threads can create new instances of the class, even while the static synchronized method is running.