Jacky Pepper wrote:In both ways there is a OtherClass instance-object available, isn't it? Is there a difference?
In effect: no. In flexibility: yes. The first style forces you to be able to construct the object from intrinsic data. With the second, you could pass runtime parameters to the constructor that allow you construct the object more dynamically. Note that this also applies if 'otherClass' is marked final.
Isn't it funny how there's always time and money enough to do it WRONG?
Joined: Jul 20, 2012
Thanks John and Winston!
... to be more clear, the examples should look like that: