Kind of a follow up question to Why can't Java constructors be synchronized?: if an object's constructor can't be synchronized, does that mean it's impossible to create two instances at literally the same time? For instance:
public class OutgoingMessage {
public OutgoingMessage() {
this.creationTime = new Date();
}
Date creationTime;
}
Would creationDate.getTime()
always return a different value? I'm aware of the basics of multitasking/multithreading but what about multiple CPU cores? In that case the operating system doesn't have to switch contexts or am I wrong here?