What is better programming style in Java?
E.g. if I have:
SomeObject createObject();
void process(SomeObject o);
Is this better?
process(createObject()) or
SomeObject o = createObject();
process(o);
Or something else? Or there is no difference or disadvantage?
You can go with any approach but calling the method before passing its result to some other method is good.
So that if there is an exception in the previously called method then you can trace it easily.
Readability is also a plus with this approach and you can also call some other method using the same object reference if there is any.