As per specifications, we can not synchronize a constructor of any object because other threads cannot see the object being created before the thread creating it has finished it. But as per JMM, during creation of an object memory can be allocated and referred to the reference variable before its states are initialized.
So why Java should not allow synchronize method along with constructors to publish always thread safe object reference?
Asked
Active
Viewed 71 times
2

Maroun
- 94,125
- 30
- 188
- 241

user2392631
- 497
- 8
- 15