Sorry if title phrasing is bad, feel free to edit if need be.
Let's assume a Main Class, that creates an object from the class A, whose constructor receives an object from the class B as a parameter. One way to code it is :
B b = new B(); A a = new A(b);
Which would yield the following UML Sequence Diagram :
But now, let's say I want to code it in another way, so as to not keep a reference to the B object (make it anonymous), like this :
A a = new A(new B());
Which of the following UML Sequence Diagrams would it yield ?
First option (not changing the overall order of operations) :
Second option (changing the order) :
In other words, would the B object be created by the Main class, or by A's constructor ?