This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
No object is garbage collected. First off, there is only one object created at line 1. Both the variables a and b refer to the same object. When u set a to null, b still refers to the object. So the object can't be GC-ed.
and even if there were 2 objects you still could not tell whether any were being garbage collected and if both then in which order. All you can do is suggest the JVM that now would be a good time to run the garbage collector, you cannot tell the GC what to do.