EDIT: yes, after the second b assignment statement "b=a;", no variable point to the location where "hello" is stored, so that data is garbage and Java will automatically free up that memory for you
---------------------------------------------------------------------------------------
^err, no, b points to the same location a used to, so no garbage.
In java, objects do not hold the value, but rather a reference to the value.
so, after String a = "hello";, a does not actually hold "hello", but a reference to the location in memory where "hello" is stored.
Now, when you said a = "";, you are changing the reference stored in a to another location in memory where an empty string is stored. that is, a no longer points to the location where "hello" is stored. Now, here's why the example above doesn't count as garbage collection scenario. Since you said String b = a; before you changed a, b points to the same location as a used to. That means the string "hello" is still accessible by b.
Consider what would happen if String b = a; was never stated. Since a now references "", what happens to the memory occupied by the string "hello"? Since no object refer to that location anymore, it can no longer be accessed. It is considered garbage data. In a managed language like Java, it automatically cleans up this memory for you so you don't have to do anything to free up that memory that stores "hello". (In an unmanaged language like C++, the programmer has to delete the actual data from memory)