Steve
SCJP 5.0 and now fighting with ExtJS
Balagopal Kannampallil wrote:In the second loop the newly created objects inside the loop will take more time to get Garbage collected as the number of references are more when compared to the first loop.
My Blog SCJP 5 SCWCD 5
EFH wrote:a reference is just a reserved spot on the stack, and absolutely nothing is done at runtime to "create" one. Therefore this loop has an empty body; the Hotspot compiler is likely to optimize it away completely.
-kolli
My Blog SCJP 5 SCWCD 5
Himanshu Gupta wrote:Thanks everyone for your replies. In my code review i coded using the Loop2 style.... and it came back as a defect....
It might be considered a defect in C++, but in Java, ....... order in which they're first mentioned changes.
My Blog SCJP 5 SCWCD 5
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
Each of their nuggets of wisdom contracted to a sound bite: Joshua Bloch: Write Lots of Code; Chet Haase: Don't Put Your Entire Application in One Method; Masood Mortazavi: Start Simple and Keep Learning; Cay Horstmann: First, Don't Panic
Each of their nuggets of wisdom contracted to a sound bite: Joshua Bloch: Write Lots of Code; Chet Haase: Don't Put Your Entire Application in One Method; Masood Mortazavi: Start Simple and Keep Learning; Cay Horstmann: First, Don't Panic
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |