Page 1 of 1

a == "java"

Posted: Sun Mar 10, 2013 10:13 am
by The_Nick
Ok one more question related to this thread:
Why a=="java"; gives true?

The operator == checks whether or not the 2 variables point to the same object or not. "java" is not a reference variable to nothing is just the content. Why does it work that way?

Thanks in advance.

The_Nick.

Re: About Question enthuware.ocajp.i.v7.2.1212 :

Posted: Sun Mar 10, 2013 10:23 am
by admin
The actual content "java" is stored at a location, this location address is compared to a.
Please don't take it wrong way but the questions that you are asking are really basic. You should first study from a good book such as "Thinking in Java". It will help you a lot.
I can only give you brief explanation but you need a continuous development of concepts, which can be done only by reading a book.

thank you,
Paul.