In practice, the code in both cases does exactly the same thing. Most compilers will generate effectively the exact same class file from either version of your code. The only real difference between the two is at the compiler level - if you had tried to access obj outside the loop in which it was declared, the compiler would have prevented you from doing so. Since you didn't try to do that, it doesn't matter. Even though the variable obj is declared inside the loop, the compiled class file allocates space for it on the frame at the very beginning of the method, and frees this space at the end of the method.
So, in either case, what happens to the 100 objects? Well, 1000 objects are created. 999 of them are forgotten as soon as the next one is created, and are eligible for garbage collection as soon as it runs. The last one will technically be eligible for GC when the method exits. In practice it can actually get collected before that - HotSpot is capable of detecting that the obj reference is not being used any more, and evidently optimizes its implementation of the class file so as to allow the object to be collected even before the method exits. Strange but true. See
Bill Brogden's discussion of this phenomenon, from a sample question that proved far more complex than he intended.