A
Angus Parvis
Hi,
I just asked myself, whether it is better to declare a variable inside
or outside a block, if you only want to use it inside the block;
I always do it like this:
String foo;
while (true) {
foo = new String();
}
Guess that's better than:
while (true) {
String foo = new String();
}
In the second example i declare the variable String foo every time the
loop is repeated - guess that's the worse solution, isn't it?
Well, I'd be interested in your comments on this,
thanks in advance,
Angus
I just asked myself, whether it is better to declare a variable inside
or outside a block, if you only want to use it inside the block;
I always do it like this:
String foo;
while (true) {
foo = new String();
}
Guess that's better than:
while (true) {
String foo = new String();
}
In the second example i declare the variable String foo every time the
loop is repeated - guess that's the worse solution, isn't it?
Well, I'd be interested in your comments on this,
thanks in advance,
Angus