Well this code is more about objects and reference variables than it is about garbage collection, and I'll let ranchers talk about that. But, in case this conversation moves too far forward, remember that on the real exam, GC questions will never use objects of type String.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Since disp and show are declared inside a method they are considered as local variable.References of disp & show live on stack & objects associated with them is created on heap. As there visibility is only till main method,therefore after completion of main method they are eligible for garbage collection.
Also note that instance variables & objects live on heap.