I'm working on a problem now where I can hide every single variable inside the methods that actually use that variable. The conundrum I'm in is this. One of my methods is called multiple times and, if a certain value is not passed, will create some
String arrays. If I'm understanding the way the heap works, these objects are doomed once my method completes.
I could just as easily move them out of the method and make them global, and I keep looking at it, moving them back and forth. One part says "Why initialize them over and over?" and the other part says "if that certain condition is passed you'd never need them anyway!". I'm leaning more towards only having them created once as I can just imagine a bunch of objects wallowing in null-dom, but I'd also like to get more seasoned opinions as well.
Thanks in advance,
Nate
The very existence of flamethrowers proves that at some time, some where, some place, someone once said to themselves "I'd really like to set those people on fire over there, but I just can't get close enough".