J
Jiho Han
If I have a class, whether it's simple or complex, is it better to declare
it outside of a looping construct?
For example,
CustomClass objVar;
while (somecondition)
{
objVar = new CustomClass(somevariable1, somevariable2);
...
}
vs.
while(somecondition)
{
CustomClass objVar = new CustomClass(somevariable1, somevariable2);
...
}
The question is purely regarding the declaration of the variable inside the
loop construct.
Would the second form have any detrimental effect on either the memory
consumption or the performance?
Thanks
Jiho Han
it outside of a looping construct?
For example,
CustomClass objVar;
while (somecondition)
{
objVar = new CustomClass(somevariable1, somevariable2);
...
}
vs.
while(somecondition)
{
CustomClass objVar = new CustomClass(somevariable1, somevariable2);
...
}
The question is purely regarding the declaration of the variable inside the
loop construct.
Would the second form have any detrimental effect on either the memory
consumption or the performance?
Thanks
Jiho Han