7

Which is better way to introduce variables in Java/Android?

view full story
linux-howto

http://stackoverflow.com – Does the first example produce more efficient code than the second in Java/Android and in generally in Java? At least the first example can not be slower than second, I think.. I do not care here that the variable v may live longer time in first example, perhaps eating memory for a longer time. Of course it is true that second way of doing is more readable if you have more complicated code with several inner blocks. Also that is not the issue here. MyType v; for(int i=0;i<bigCount;++i) { v = <value produced for i>; //do something with v } for(int i=0;i<bigCount;++i) { M (HowTos)