JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Originally posted by Marilyn deQueiroz:
Constants are figured out at compile time, not at runtime. Thus optimized.
Originally posted by Dirk Schreckmann:
Righto. Is this the best practive for any data item that doesn't need to change? - even for a lowly int that is used just once in a method somewhere?
Wait a minute, I'm trying to think of something clever to say...<p>Joel
Originally posted by Dirk Schreckmann:
Is this the best practice for any data item that doesn't need to change? - even for a lowly int that is used just once in a method somewhere?
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
"I'm not back." - Bill Harding, Twister
Originally posted by Jim Yingst:
The only way I can see any performance benefit to declaring the array outside the method is if the method will execute more than once.
Originally posted by Michael Pearson:
As the number gets larger there is no way the methods will not be executed mutliple times. So, moving them to class level has benefits for this assignment.
Check out my kickstarter CLICK HERE
My book, my movies, my videos, my podcasts, my events ... the big collection of paul wheaton stuff!
Originally posted by Dirk Schreckmann:
But, I'd bet that in the final product, not a single string concatenation exists - we're outputting everything as we decide to use it. Or was that whole purposes clause regarding learning about string concatenation really just a ploy to get us to use them and then be nitpicked to not use them so we could learn that it's not very efficient?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |