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 ?
I ran a simple program with a debugger to watch when the new B object is created. It was created before the call to the constructor for a. Thus, the main class is creating it and then passing it into the constructor to create a.
Class A:
Class B:
Main