Thanks Campbell & Jesper.(corrected)
== means object reference equality and equals() means object value equality or meaningfully equal.
But don't understand what William is trying to point out by writing
is comparing "what" exactly ??
Jesper, I should have written
in the overriding equals() method as you have pointed out as they have to be meaningfully equal.
and as Winston noted,
But then the next question is , why the code printed '1, pramod' just once earlier, when I had written 'setTest.name == this.name;' in equals() method?
As I had made a mistake in equals() method, it should have always written as false.