sbhavan 30 Light Poster
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.

sbhavan 30 Light Poster

Please try to give a relative title to your threads. It will help to give proper attention to the people who replies to your queries. This will help to get genuine replies and solutions quickly.

synplace commented: Good Job +0
sbhavan 30 Light Poster

I was told i was suppose to to set some path but i am not sure where it is.

In the command prompt type: set path=%path%;<java_home>/bin; The <java_home> is the path/directory where the java was installed.

For example, the java is installed in C:\java,

The java_home is C:\java and the path is c:\java\bin.

tux4life commented: Indeed :) +21