new MyClass() -vs- MyClass mc = new MyClass()
Whenever possible or appropriate I create a new instance of an object without defining it (see 'a' below):
a) I'm not sure why but I've always assumed that when possible it is more efficient to instantiate an object that way ('a') rather than the usual defining of the variable (see 'b' below):
Is my assumption right? Or when I've seen others do this has it simply been for aesthetic reasons?
MyClass mc = new MyClass();
Also is there an official name for this use? In my testing I have one method using 'a)' and another using 'b)' in order to experiment with the differences in random number generation but I've struggled to pick method names and javadoc descriptions which make obvious the difference between the two methods. I realise that it probably doesn't matter that much but I'm a little anal about it.
I'm not new to java so I should probably know this; I have an excuse somewhere, but I think my dog ate it.
Thanks in advance,