I have a question, which is the most efficient way or that follows some standard of initializing objects for setter methods, in my work there are positions divided between memory usage and execution time, what do you think?
1st form:
ObjectA objA = new ObjectA(data);
objA.setother(other);
ObjectB objB = new ObjectB();
objB.setObjectA(objA):
2nd form
ObjectB objB = new ObjectB();
objB.setObjectA(new ObjectA(data)):
objB.getObjectA().setother(other);