both x2 and x3 shud refer to the same object. so, x2 and x3 shud be still on the heap
You are right. But a small correction, x2 and x3 are not objects, they are references to object. In this case after line 9, references x2 and x3 are pointing to the same object only.
The objects that are eligible for garbage collection are those created at line 4 and 5.(hence the answer 2)
Regards
Lakshmanan