Hi Ravindra,
Welcome to JavaRanch!
When you assign one variable the value of another, the contents of that second variable are copied to the first. If the second variable is a reference to an object, then the first variable is made to refer to that same object.
If you then later change the second variable, the first variable's value will
not change, regardless of what kind of variable it is. In your example, making ad point to "bye" does not change ac; ac still points to "hi".
I suspect you would learn a lot by reading
this and
this. They're fun to read, too!