I would think that in the second case "myObject" would be a candidate for GC when the loop exits.
Whereas in the first it would remain 'alive' until after the outer block completes execution.
I would be of the opinion that unless there are really LARGE number of these objects created inside the loop iterations the later versions of
Java should be able to optimize the memory/performance effects.
Would anyone like to elaborate, in case I am mistaken?