String message_one = "Hello!";
String message_two = "World!";
message_one points to a object having a value "Hello!"
message_two points to a object having a value "World!"
So value of message_one is "Hello!" and value of message_two is "World!"
message_two = message_one;
message_two points to the object which message_one points and the old object having the value "World!" is disconnected from message_two and the object haveing value "Hello!" is connected to message_two.
Now the value of message_one and message_two both are "Hello!"
message_one = scan.nextLine();
Now a new object is assigned to message_one.
Accordeing to your information the value of the new object is
This is a test sentence.
So Now message_one points to the new object having the value This is a test sentence. and was disconnected from the object having value "Hello!". And the message_two is unchanged so it remains point to the same object which is having the value "Hello!"
Now the value of message_one is "This is a test sentence".
And the value of message_two is "Hello!"
Is it clear now?
If you need any clarrification reply.
else if you got the solution mark this post as solved.
PS. Sorry. I have not seen there is a reply to this post and replied.